Day(1): Looking for a CS Job!
Hello, i have been employed by the world’s worst boss for 3 months, but i decided to finally break free and call it quits.
i have been unemployed for 16 days, which is not a lot if you think about it, but i am a young adult and i can worry and have anxiety as much as i like god damn it!
I love medium so much, like i really fucking do. i even pay the monthly subscription; (5$ is like 100 of my currency, so yeah!).
so i decided to daily sum what i did, so i can have a better understanding and a log of what i did and eventually look back (please soon?) and appreciate the effort i did.
So Here is what i did Today:
Read Chapter (5) In Grokking Algorithms about Hash tables and Hash Functions and other Article about hashing!
Honestly, i was always worried that i didn’t understand them correctly, but turns out i already do, but i needed a refresher when collision happens, and the idea of having a linked list totally skipped my mind! so yeah i learned that today.
and i read this amazing article (Breaking Down: SHA-1 Algorithm. Looking under the hood and… | by Aditya Anand | InfoSec Write-ups | Medium) which explains SHA-1 Algorithm.
the cool thing about SHA is that they are locally insensitive, which means changing a letter from Dog to Dug for example, yields two different complete results! fucking cool. (there is a variant called SimHash which is uncool, yeah you guessed it right, locally sensitive.. but i guess you can check similar items with it if you are boring).
Shootout to Proff. Hazem from AinShams (he taught me a lot about RSA , Diffie-Hellman algorithms: Public/Private keys)
i did some simple problem solving about hashing too:
Encode and Decode TinyURL — LeetCode (it’s basically intended so you can make a Hash function with a corresponding hash table or just a map with an index if you want, how am i to judge) For this question, i decided i would just for every string, i would return a prime number and that’s it, and while this is simple solution, i thought about the obvious limitation of extra long big numbers, that will require me to generate large prime numbers every iteration (which is a complex problem in computational number theory: Generation of primes — Wikipedia), so instead of generating a prime number, let’s modulo by a prime number! (lecture2.pdf (ox.ac.uk))
Problem Solving a day , keeps sleeping mind away
i fucking love python, let’s just make that clear too.
but you know who doesn’t like python, people who interview me, i am waiting for the upcoming interview of mine (monday woohoo!) and it’s for a C++ position, so to break the mold of me always using python ,i will try and solve today’s December challenge using C++ ( i will even use auto, don’t judge me)
it was called 4SUM II, and for my luck, it was also tagged with Hashing.
it took me more than i care to admit, but i did it.
you are given 4 Vectors: A B C D and you are required to find tubles (i,j,k,l) that will A[i}+…+D[L]=0.
I made a map with A+B and map with -(C+D). and viola, it’s over.
Computer Vision is … Visionary!
i have been working with making a project where you use your hand to draw something (hand is detected by either segmentation or SSD Net) and then the drawing takes place.
i am achieving good results: https://youtu.be/O0KwbtfEN0w (This is from yesterday) but i wanted to try a SSD (Single shot detection) and i ended up using Google’s Mediapipe (Although it’s incredibly noisey at some test cases).
so i guess i have to figure a way to use both of them at the same time.
Also, i read few pages of the contour section from the Learning OpenCV3 book. (it’s a cool book, but amazingly lacking in maths), i am trying to brain storm to find a way to be able to get only one point per corner.
i want to basically get one Yellow point per ‘corner’. i did some conditioning which works -most- of the cases, will try to improve it and work in parrallel with mediapipe’s solution.
So Today’s progress is :
1- Tried to Use GoodFeaturesToTrack and HarrisCornerDetection in an attempt to filter those points, but it didn’t work out.
2- Approximating the Hull (red) to a poly didn’t yield good results.
3- Tried Fine tuning the filteration but results didn’t make much of a difference.
4- Added the ability to draw when using mediapipe.
(i may come back later on this blogpost and update if i though of something else)
Pointers that are ..SMART?
i learned today about std::unique_ptr,std::shared_ptr and std::weak_ptr.
in Brief, they are called smart pointers because you don’t manually delete them and you don’t use the ‘new’ keyword with them.
Unique_ptr cannot be copied, hence it’s unique hehe.
SharedPtr can be copied, and when it’s copied, a control block alled Ref_Counter increases. and that underlying entity is deleted when that Ref_Counter Reaches Zero.
WeakPtr is a version of SharedPtr that can copy from the sharedPtr, but doesn’t increase the count.
to create a sharedPtr use make_shared and obv. to create a Unique pointer, you guessed it.. i know you did … make_unique()
so yeah.. i learned that from the Cherno on youtube.
Machine Learning Explainability On kaggle
Permutation Importance : After the model is fit on the data, shuffle one column (One feature) and see how much our prediction goes wrong due to the shuffling of that feature
Partial plots: Slightly Changing a feature on one-axis, plot the difference in the prediction. (If we it’s a regression model of course)
Feature Importance: Golden feature, the feature that has the most weight on determining the output.
SHAP: breaks down a prediction to show the impact of each feature.
Read this amazing article on medium:
Take away is about the Cons of Polymorphism: All you need to know for our purposes is that polymorphic behaviour is enabled in C++ using something called a virtual table. A virtual table is an array that stores the addresses of all the virtual functions for a class. When a call is made on a virtual function, the code must navigate to the virtual table, look up which function to call, then go to the address and call to the function. With a normal non-virtual function, we simply go to the function’s address. In certain situations where the computer is already doing a lot of work, these extra steps can slow things down.
Did few more and that’s the end!
Solving the questions found in this excel sheet!