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 #14: [Maximize the volume of Cuboid]

Given the sum of length, breadth and height of a cuboid. The task is to find the maximum volume that can be achieved such that the sum of sides is S.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer S.

Output:
For each test case, print the maximum volume you can obtain in new line.

Constraints:
1<=T<=500
3<=S<=105

Example:
Input:

2
4
8

Output:
2
18


Explanation:
Input : S = 8
Output : 18
All possible edge dimensions:
[1, 1, 6], volume = 6
[1, 2, 5], volume = 10
[1, 3, 4], volume = 12
[2, 2, 4], volume = 16
[2, 3, 3], volume = 18
 
Solution:
  
Lets give our examples:
INPUT: 
3
65
21
31 
1# Sum_Of_Sides = 65; We check if Sum_Of_Sides is divisible by 3.
    No it isn't
    Check if Sum_Of_Sides modul by 3 has remindеr 1.
    No, it hasn't
    So Sum_Of_Sides % 3 = 2 
    print (Sum_Of_Sides➗3 + 1 ) ^2 * (Sum_Of_Sides ➗ 3);
2# Sum_Of_Sides = 21; We check if Sum_Of_Sides is divisible by 3.
      Yes it is: print (Sum_Of_Sides3)^3;
3# Sum_Of_Sides = 31;
     31 3 = 10 ; (reminder = 1)
     print  (Sum_Of_Sides3)^2 * (Sum_Of_Sides ➗ 3 + 1);
That 'divisible by 3 ' is cause [Breadth, Height, Length]
This problem is mathematics also 😄 
 

Popular posts from this blog

Math Problem -> Combinatorics: Foreign alphabet

Competitive Programming #29 : [LineUp]

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