Machine Learning with Python – Practical Questions
1. Write a Python program using NumPy to:
▪ Create a 1D and 2D array
▪ Find shape, size, and datatype
▪ Perform addition and multiplication operations
2. Write a Python program using Pandas to:
▪ Create a DataFrame
▪ Display first 5 rows
▪ Find missing values in the dataset
3. Write a Python program using Matplotlib to plot:
▪ Line graph
▪ Bar graph
▪ Pie chart using sample student marks data
4. Correlation Matrix
o Write a Python program to:
▪ Load a dataset
▪ Calculate correlation between features
▪ Display the correlation matrix
5. Write a Python program using Scikit-learn to:
▪ Implement Linear Regression
▪ Train the model using sample data
▪ Predict output values
▪ Calculate accuracy/error metrics
6. Write a Python program to implement Logistic Regression for binary classification using
a dataset of student pass/fail records.
7. Write a Python program to:
▪ Implement KNN classification
▪ Train and test the model
▪ Display prediction results and accuracy score
8. Write a Python program to implement a Decision Tree classifier and visualize the
decision tree for a sample dataset.
9. Write a Python program to:
▪ Implement K-Means clustering
▪ Divide data into clusters
▪ Visualize clusters using graphs
10. Write a Python program using Natural Language Processing (NLP) techniques to classify
emails/messages as spam or ham.