Here the top 10 machine learning projects which help to learn the basic concept of machine learning. After completion of this we will learn some advanced topics of machine learning.
1: Understanding Pandas
Before start learning machine learning first know about the pandas, here we will learn pandas with the help of some questions which is given below:
Consider the following Python dictionary data and Python list labels:
data = {'birds': ['Cranes', 'Cranes', 'plovers', 'spoonbills', 'spoonbills', 'Cranes', 'plovers', 'Cranes', 'spoonbills', 'spoonbills'], 'age': [3.5, 4, 1.5, np.nan, 6, 3, 5.5, np.nan, 8, 4], 'visits': [2, 4, 3, 4, 3, 4, 2, 2, 3, 2], 'priority': ['yes', 'yes', 'no', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no']}
labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
Create a DataFrame birds from this dictionary data which has the index labels.
Sol.
#import libraries
import pandas as pd
import numpy as np
Read data:
data = {'birds': ['Cranes', 'Cranes', 'plovers', 'spoonbills', 'spoonbills', 'Cranes', 'plovers', 'Cranes', 'spoonbills', 'spoonbills'], 'age': [3.5, 4, 1.5, np.nan, 6, 3, 5.5, np.nan, 8, 4], 'visits': [2, 4, 3, 4, 3, 4, 2, 2, 3, 2], 'priority': ['yes', 'yes', 'no', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no']}
Creating a data frame:
birds = pd.DataFrame(data, index = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'])
birds
Do itself
Display a summary of the basic information about birds DataFrame and its data.
Print all the rows with only 'birds' and 'age' columns from the dataframe
select [2, 3, 7] rows and in columns ['birds', 'age', 'visits']
select the rows where the number of visits is less than 4
select the rows with columns ['birds', 'visits'] where the age is missing i.e NaN
Select the rows where the birds is a Cranes and the age is less than 4
Select the rows the age is between 2 and 4(inclusive)
Find the total number of visits of the bird Cranes
Calculate the mean age for each different birds in dataframe.
2: Practice to write the functions in Python
After learning pandas next one is how to write code using functions in python because the function in python machine learning is an important part, here we have provided some questions so you can practice here if you face any issue you can ask with codersarts experts.
Do it itself:
1. Write a function that inputs a number and prints the multiplication table of that number
2. Write a program to print twin primes less than 1000. If two consecutive odd numbers are both primes then they are known as twin primes
3. Write a program to find out the prime factors of a number.
Example: prime factors of 56 -
2, 2, 2, 7
4. Write a program to implement these formulae of permutations and combinations.
Number of permutations of n objects taken r at a time: p(n, r) = n! / (n-r)!. Number of
combinations of n objects taken r at a time is: c(n, r) = n! / (r!*(n-r)!) = p(n,r) / r!
5. Write a function that converts a decimal number to binary number
6. Write a function cubesum() that accepts an integer and returns the sum of the cubes of
individual digits of that number. Use this function to make functions PrintArmstrong() and
isArmstrong() to print Armstrong numbers and to find whether is an Armstrong number.
7. Write a function prodDigits() that inputs a number and returns the product of digits of that number.
8. If all digits of a number n are multiplied by each other repeating with the product, the one digit number obtained at last is called the multiplicative digital root of n. The number of times digits need to be multiplied to reach one digit is called the multiplicative
persistance of n.
Example: 86 -> 48 -> 32 -> 6 (MDR 6, MPersistence 3)
341 -> 12->2 (MDR 2, MPersistence 2)
Using the function prodDigits() of previous exercise write functions MDR() and
MPersistence() that input a number and return its multiplicative digital root and
multiplicative persistence respectively
9. Write a function sumPdivisors() that finds the sum of proper divisors of a number. Proper divisors of a number are those numbers by which the number is divisible, except the number itself. For example proper divisors of 36 are 1, 2, 3, 4, 6, 9, 18
10. A number is called perfect if the sum of proper divisors of that number is equal to the
number. For example 28 is perfect number, since 1+2+4+7+14=28. Write a program to
print all the perfect numbers in a given range
11. Two different numbers are called amicable numbers if the sum of the proper divisors of each is equal to the other number. For example 220 and 284 are amicable numbers.
Sum of proper divisors of 220 = 1+2+4+5+10+11+20+22+44+55+110 = 284
Sum of proper divisors of 284 = 1+2+4+71+142 = 220
12. Write a function to print pairs of amicable numbers in a range
3. Practice to write code in Python: without numpy or sklearn
Now we will practice writing code without any libraries like NumPy or sklearn.
Do it itself:
Print the product of two matrices without any libraries
Select a number randomly with probability proportional to its magnitude from the given array of n elements
Replace the digits in the string with #
Find the closest points: Consider you are given n data points in the form of list of tuples like S=[(x1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5),..,(xn,yn)] and a point P=(p,q)
Your task is to find 5 closest points(based on cosine distance) in S from P
If you need any help related to any of the above topics which is most important in machine learning then you can contact us here:
contact@codersarts.com
Comments