Linear Regression Assignment
1. Load the dataset using pandas
2. Extract data fromYearsExperience column is a variable named X
3. Extract data from salary column is a variable named Y
4. Divide the dataset into two parts for training and testing in 66% and 33% proportion
5. Create and train LinearRegression Model on training set
6. Make predictions based on the testing set using the trained model
7. Check the performance by calculating the r2 score of the mode
Naïve-Bayes Assignment
1. Load the dataset using pandas
2. Extract data fromOutcome column is a variable named Y
3. Extract data from every column except Outcome column in a variable named X
4. Divide the dataset into two parts for training and testing in 70% and 30% proportion
5. Create and train Naïve Bayes Model on training set
6. Make predictions based on the testing set using the trained model
7. Check the performance by calculating the confusion matrix and accuracy score of the model
Decision Tree Assignment
1. Load the dataset using pandas
2. Extract data fromOutcome column is a variable named Y
3. Extract data from every column except Outcome column in a variable named X
4. Divide the dataset into two parts for training and testing in 70% and 30% proportion
5. Create and train Decision Tree Model on training set
6. Make predictions based on the testing set using the trained model
7. Check the performance by calculating the confusion matrix and accuracy score of the model
1. Load the dataset using pandas
2. Extract data fromYearsExperience column is a variable named X
3. Extract data from salary column is a variable named Y
4. Divide the dataset into two parts for training and testing in 66% and 33% proportion
5. Create and train LinearRegression Model on training set
6. Make predictions based on the testing set using the trained model
7. Check the performance by calculating the r2 score of the model
Given a string, write a program to remove all the words with K length.
Input
The first line of input String A.
The second line of input an integer K.
Output
The output should contain a string after removing all the words whose length is equal to K.
Explanation
For example, string A is "Tea is good for you", k is 3 then output should be "is good."
Here words "Tea","for","you" length is equal to 3, so these words are removed from string.
You work in XYZ Corporation as a Data Analyst. Your corporation has told you to visualize the mtcars.csv dataset with various plots. Tasks to be performed:
Dataset Link 1. Plot a histogram for the column ‘wt’.
a. Map the ‘wt’ onto the x-axis.
b. Provide the x-axis label as ‘weight of the cars’.
c. Provide the y-axis label as ‘Count’
d. Set the number of bins as 30.
e. Set the title as ‘Histogram for the weight values
Write recursive functions (you are not allowed using for or while loops) to solve the following problems:
-Write a function that prints hello for 500 times
-x in power y ( )
-Geometric progression with common ratio r. For example, the sequence 2, 6, 18, 54, ... is a geometric progression with common ratio 3
Sum of the series
Write a program to find the sum
S of the series where S = x - x^3 + x^5 + ....... upto N terms.
Sample Input 1
2
5
Sample Output 1
410
to solve this approch
if i value is even:
result = summation of the term value and then added to the result
else :
result = Subtraction of the term value and then added to the result
Multiple of 3:
(1) Input: 6 Output: 3
1 9
2 6
3
5
9
6
(2) Input: 4 Output: 3
1 6
3
6
8
Multiple of 5 :
(1) Input: 6 Output: 1
1 2
2 3
3
5
9
6
(2) Input: 5 Output: 1
1 2
2 3
3 4
4
5