MeanNearestNeighbors (MNN) - algorithm for balancing dataset - In progress #1

Image
One of the challenges in classification problems are unbalanced datasets. I was Data Science Intern when the company that I worked for, assigned me such an interesting challenge where the dataset was unbalanced.  However, I realized this type of problem like unbalanced dataset is а common thing in real life. I tried most of the algorithms (undersampling, oversampling) like SMOTE, NearMiss, CondensedNearestNeighbors, RandomUnderSampler, RandomOverSampler,  KMeansSMOTЕ and rest of them. Anyway, they didn't help me in that case, on the contrary, they worsened my model.  I was like: "but, but, you should have been helpful in creating the predictive model" So, I'm trying to create another algorithm based on undersampling concept when it comes to balancing datasets. I called it Mean Nearest Neighbors (MNN). What's the initial idea: It's simple. Actually, the algorithm is just a modification of the other undersampling algorithms. In the data where target labe...

Competitive Programming #7: Bit Manipulation -> Fast and Easy to Convert Integer into Binary


This is the code...  (t is number that we want to convert into binary)
If you are beginner ,
you will certainly ask why i=31?
well ... we know that every integer (int) is 32bit-type (has 32bits)
So example: 

43 = 00000000000000000000000000101011
 2 =  00000000000000000000000000000010
& - BitAnd operation
  10001 & 11001 = 10001

(1<
Left Shift appends i zero bits to the number (in our case 1)
We check for every bit 0 - 31  . So example:
INPUT
2

if(2&(1<
   #translate: Is 2 (binary 10) AND 100000000000000000000000000000) is TRUE

  100000000000000000000000000000
&                                                       10
------------------------------------------------ 
      00000000000000000000000000000 

Repeat this proccess (with decreasing 'i')
your output will be 10. 
     
  

Popular posts from this blog

Math Problem -> Combinatorics: Foreign alphabet

Competitive Programming #29 : [LineUp]

Intro to Quantum Computing: Што ќе ми треба ова сега? #1