Posts

Showing posts from June, 2018

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 #28 : [Divisor Product]

Victor is playing with divisors of a number N. He is curious about the product of all these divisors. Given a number N, help him find the product of all the divisors of N (including N). Since the products can be large, print the answer modulo (10^9 + 7). Input :  First line of input contains a single integer T denoting the number of test cases. The only line of each test case contains an integer N. Output :  For each test case, print the required answer in a new line. Constraints :  1 <= T <= 200 1 <= N <= 10^9 Example : Input :  3 6 9 12 Output :  36 27 1728 Explanation : Case 1 :  Divisors of 6 : 1, 2, 3, 6 Product = 1*2*3*6 = 36 Case 2 :  Divisors of 9 : 1, 3, 9 Product = 1*3*9 = 27 Case 3 :  Divisors of 12 : 1, 2, 3, 4, 6, 12 Product = 1*2*3*4*6*12 = 1728 Solution: ------------------------------------    Since N takes large values, brute force won't work. So let's do mat...