Notes on multi-multi-class classifiers

Summary Here is an early draft of a post, trying to extract some of the insights from the project here. There is a lot to write about and I want to just start getting it out. Quick outline The logloss upper bound Does the “k area” metric help? training balancing Is it possible to calculate the Bayesian error rate here? And logloss seems to be very sensitive. (can look at correlations , not super high) So what metric should be used ? And re-calc that train error so I can compare against test error to understand level of bias/variance The logloss upper bound Training set accuracy and test set accuracy have intuitive boundaries, between 0 and 1, but logloss does not feel intuitive. ...

July 13, 2020 · (updated February 26, 2023) · 7 min · 1452 words · Michal Piekarczyk

Some xgboost notes so far

Let’s summarize I want to just summarize some learnings from some of my recent notebooks yea. I have picked up my bike share data learning project from earlier, to try to redo it after having gathered more experience. I want to just jot down some ad hoc thoughts here. This is mainly around navigating XGBoost. There are two XGBoost APIs With the sklearn API you can import xgboost as xgb from xgboost import XGBClassifier import numpy as np from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score, log_loss X, y = np.random.random(size=(1000, 3)), np.random.choice([1, 0], size=(1000,), replace=True) X_train, X_test, y_train, y_test = train_test_split(X, y) model = XGBClassifier().fit(X_train, y_train) y_pred_prob = model.predict_proba(X_test) y_pred = np.argmax(y_pred_prob, axis=1) acc = accuracy_score(y_test, y_pred) print(acc) And you can also just ...

June 21, 2020 · (updated February 26, 2023) · 4 min · 763 words · Michal Piekarczyk

Does the Wahoo TIKR measure intervals that can be used for Heart Rate Variability measurements?

Not sure yet. There are a fitness trackers out there, but I am curious if my chest band can help. I took a quick look at one of my recordings on the Wahoo app, but I don’t see anything more granular than just beats per minute. The app indeed has pushed to Apple Health, but I only see the bpm data and no HRV data. Didnt finish this but I tried parsing the raw fit file Making a note for later I suppose. I git cloned fit_processing , which requires installing fitparse But when I ran python3 process_all.py --subject-name=mysubjectname --fit-source-dir=/media/myname/GARMIN/Garmin/ACTIVITY/ I got doing FIT conversions activity files: ['2020-02-06-160620-FITNESS 3A6A-20-0.fit'] new names: ['2020-02-06-160620-FITNESS 3A6A-20-0.fit'] current_files: {'2020-02-06-160620-FITNESS 3A6A-20-0.fit'} 2020-02-06-160620-FITNESS 3A6A-20-0.fit already exists... converting ....../fit_files/2020-02-06-160620-FITNESS 3A6A-20-0.fit ... File "/...../fit_processing/process_all.py", line 1, in <module> import os ... File "/usr/local/miniconda3/envs/pandars3/lib/python3.7/site-packages/fitparse/records.py", line 450, in add_dev_field_description field_def_num = message.get('field_definition_number').raw_value AttributeError: 'NoneType' object has no attribute 'raw_value' And I got the same result when trying the raw docs here for fitparse itself. To be fair those docs appear to be python2.7 docs. Of course also possible that not all .fit files, Wahoo or Garmin, have the same kinds of data. Maybe fitparse was tested only on Garmin .fit files?

June 6, 2020 · (updated March 18, 2023) · 1 min · 201 words · Michal Piekarczyk

How to use Github pages with multiple repositories

Spoiler alert, don’t do it I wrote some high level and low level markdown summaries for my aviation kaggle data sciency project. I placed them in the github repo of the project itself. Today I have been thinking about how to best build the Github Pages repo to showcase those markdowns that live in that other repository. Looking for inspiration, I saw this author has chosen to have a typical github.io repo and also a separate portfolio repo. On the other hand this author’s approach was to maintain any source python notebook and markdown files within the main GithubPages repo itself. ...

May 31, 2020 · (updated November 3, 2024) · 2 min · 242 words · Michal Piekarczyk

Steak Puzzle

I have been trying to solve the steak puzzle for several attempts now. That is, how do you cook a good cast iron to oven transfer? The problem so far has been that the recommended time for the oven for a 450 finish, in this article , 4-5 minutes is the recommendation for a medium steak and 2-4 minutes for a rare. Although I did not quite follow the 450, I used 400 F, I followed the temperature lore from here last night, using a meat thermometer instead of time, because I suspect oven temperatures in one oven is not the same as that of another. There are possibly incorrect temperature readings. ...

May 31, 2020 · (updated November 3, 2024) · 3 min · 427 words · Michal Piekarczyk

Updates

Summary I tried rebuilding today after 7 months of forgetting how this works and when I tried to jekyll build I got $ jekyll build Traceback (most recent call last): ... /usr/local/Cellar/ruby/2.6.5/lib/ruby/2.6.0/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version': You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError) Per this answer, I ran gem list bundler to see my rubygems version and then gem update --system $ gem list bundler *** LOCAL GEMS *** bundler (2.0.2, 1.17.2) $ gem update --system Updating rubygems-update Fetching rubygems-update-3.1.3.gem Successfully installed rubygems-update-3.1.3 ... ... RubyGems installed the following executables: /usr/local/Cellar/ruby/2.6.5/bin/gem /usr/local/Cellar/ruby/2.6.5/bin/bundle RubyGems system software updated Now I get $ gem list bundler *** LOCAL GEMS *** bundler (default: 2.1.4, 2.0.2, 1.17.2) $ And now my jekyll build worked!

May 30, 2020 · (updated February 26, 2023) · 1 min · 120 words · michal

Keras Hello WOrld

Here I’m doing one of the Keras hello world micro projects, involving classification of tiny 28x28 wardrobe images. This was really fun. ( Here’s the original home for the python notebook). One really fun part of this was that at the end I hand drew my own clothing samples, paired them down using the python PIL library and threw them against the classifier. Surprisingly, the mini model performed really well. That’s some generalizability! ...

May 13, 2019 · (updated February 26, 2023) · 10 min · 1975 words · Michal Piekarczyk

Using ffmpeg to Merge Videos

Put together our hyperlapse puzzle videos… First stab at a merge using ffmpeg time ffmpeg -safe 0 -f concat -i infiles.txt -vcodec copy -acodec copy merged.MOV full output here and used this infiles.txt , following the directions file ./2019-03-09\ 23.03.34.mov file ./2019-03-10\ 01.21.50.mov file ./2019-03-10\ 13.01.46.mov file ./2019-03-10\ 13.03.59.mov file ./2019-03-10\ 13.05.02.mov file ./2019-03-10\ 18.43.53.mov Did it do the right thing? What are my mov lengths.. $ cat fileslist.txt |xargs -t -I % sh -c 'ffmpeg -i "%" 2>&1 |grep Duration ' sh -c ffmpeg -i "./2019-03-09 23.03.34.mov" 2>&1 |grep Duration Duration: 00:00:30.40, start: 0.000000, bitrate: 14837 kb/s sh -c ffmpeg -i "./2019-03-10 01.21.50.mov" 2>&1 |grep Duration Duration: 00:00:34.50, start: 0.000000, bitrate: 14971 kb/s sh -c ffmpeg -i "./2019-03-10 13.01.46.mov" 2>&1 |grep Duration Duration: 00:00:00.07, start: 0.000000, bitrate: 15840 kb/s sh -c ffmpeg -i "./2019-03-10 13.03.59.mov" 2>&1 |grep Duration Duration: 00:00:01.40, start: 0.000000, bitrate: 16455 kb/s sh -c ffmpeg -i "./2019-03-10 13.05.02.mov" 2>&1 |grep Duration Duration: 00:00:32.63, start: 0.000000, bitrate: 14944 kb/s sh -c ffmpeg -i "./2019-03-10 18.43.53.mov" 2>&1 |grep Duration Duration: 00:00:39.10, start: 0.000000, bitrate: 14868 kb/s And the length of the merged movie created … $ ffmpeg -i merged.MOV 2>&1|grep Duration Duration: 00:02:18.10, start: 0.000000, bitrate: 14921 kb/s Doing some quick mental maths, that actually roughly adds up. Grr but at minute 1:05 it flips the video What the heck? Ah according to stackoverflow , ffmpeg uses rotation metadata to autorotate. Except heh in this case perhaps the autorotate did not happen when I was concatenating? My file 2019-03-10 13.05.02.mov appears to be the one which was rotated. Trying to process it to see what happens… ffmpeg -i 2019-03-10\ 13.05.02.mov -c:a copy 2019-03-10\ 13.05.02.ROTATED.mov Wow that took at least a minute. So umm, since the initial concatenation took under a second, I seriously doubt the autorotation was done during the concatenation. Okay, lets try that concat one more time, this time with the new file… and new files list file ./2019-03-09\ 23.03.34.mov file ./2019-03-10\ 01.21.50.mov file ./2019-03-10\ 13.01.46.mov file ./2019-03-10\ 13.03.59.mov file ./2019-03-10\ 13.05.02.mov file ./2019-03-10\ 18.43.53.mov time ffmpeg -safe 0 -f concat -i infiles.2019-03-16T2004Z.txt -vcodec copy -acodec copy 2019-03-16T2006Z-puzzle-merged.MOV Unfortunately, 2019-03-16T2006Z-puzzle-merged.MOV is even worse, because for some reason, only one frame is displayed for several minutes. So some more tweaking is needed. Appendix full output of the merge command ffmpeg version 4.1.1 Copyright (c) 2000-2019 the FFmpeg developers built with Apple LLVM version 10.0.0 (clang-1000.11.45.5) configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 Input #0, concat, from 'infiles.txt': Duration: N/A, start: 0.000000, bitrate: 14833 kb/s Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc), 1920x1080, 14833 kb/s, 30 fps, 30 tbr, 600 tbn, 600 tbc Metadata: rotate : 180 creation_time : 2019-03-10T05:20:20.000000Z handler_name : Core Media Video encoder : HEVC Output #0, mov, to 'merged.MOV': Metadata: encoder : Lavf58.20.100 Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc), 1920x1080, q=2-31, 14833 kb/s, 30 fps, 30 tbr, 19200 tbn, 600 tbc Metadata: rotate : 180 creation_time : 2019-03-10T05:20:20.000000Z handler_name : Core Media Video encoder : HEVC Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [mov @ 0x7fba5d80dc00] Non-monotonous DTS in output stream 0:0; previous: 1246080, current: 1246080; changing to 1246081. This may result in incorrect timestamps in the output file. frame= 2828 fps=0.0 q=-1.0 size= 172544kB time=00:01:34.20 bitrate=15005.1kbitsframe= 4142 fps=0.0 q=-1.0 Lsize= 251538kB time=00:02:18.00 bitrate=14931.9kbits/s speed= 148x video:251484kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021355% real 0m1.186s user 0m0.124s sys 0m0.232s reference xargs reference

March 16, 2019 · (updated February 26, 2023) · 4 min · 664 words · Michal Piekarczyk

Some plant time lapse

Some time lapse photography.

January 7, 2018 · (updated March 18, 2023) · 1 min · 4 words · Michal Piekarczyk

Spoke too soon

Darn, I was riding for at least one to two days thinking, why am I riding much slower? Last night I finally noticed that wow my rear wheel is really wobbly and rubbing up against the breaks quite a bit lately. This morning I finally started setting up to true the wheel. I marked the spoke which looked like adjusting it would have the highest impact. And wow I didnt notice it completely sheared off. ...

December 1, 2017 · (updated February 26, 2023) · 1 min · 114 words · Michal Piekarczyk