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 #26: [Product of Prime Factors]

First of all , I apologize about the absence from the blog . I had a lot of exams, cause this was my last year of High School , so I had hard studying ....
Okay , let's continue with our work 😇 , with our programming problems .
--------------------------------------------------------------------------------------


Given a number N find the product of all unique prime factors of that number.
Input:
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. The first line of each test case contains the number N for which the result is to be calculated. 

Output:
Print the product of the unique prime factors for each number in a new line.​

Constraints:
1<= T <=100
1<= N <=100000

Example:
Input
2
10
25

Output:
10
5


Solution:
-----------------------------
Every integer is made of prime factors .
Let's see some examples:
90 = (3^2) * 5 * 2
52 =  13 * (2^2 )
21 = 7*3
9 = 3*3

100= (5^2) * (2 ^2)
So in the problem say ' find the product of  ALL UNIQUE PRIME FACTORS' so in our examples
90 = 3*5 *2 = > 30

52 = 13* 2 = > 26
21 => 21
9 => 3
100 = 5*2 => 10
So the solution : 

 

Popular posts from this blog

Math Problem -> Combinatorics: Foreign alphabet

Competitive Programming #29 : [LineUp]

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