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 #12 : [Count numbers with unit digit K in given range]

I had exams this week and finally its f****** over . So we continue with our competitive programming problems. This is the problem:

Given a range from low to high and a number K. The task is to count the number which has the unit digit equal to K.
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 three numbers low, high and K.

Output: For each test case, print the count  of numbers in new line.
Constraints: 1<=T<=100
1<=low<=high<=109
0<=K<=9
Example:
Input:

2
4 9 4
3 35 3
Output:
1
4

Explanation:

Input  : low = 3, high = 35, K = 3 
Output : 4
Numbers are  3, 13, 23, 33.
 
Solution :
 
 
 
 

Popular posts from this blog

Math Problem -> Combinatorics: Foreign alphabet

Competitive Programming #29 : [LineUp]

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