<jupyter_start><jupyter_text>Fetch the dataset<jupyter_code>response = requests.get('https://archive.ics.uci.edu/ml/machine-learning-databases/00320/student.zip')
zipcontent= response.content
with open("/tmp/student.zip", 'wb') as f:
    f.write(zipcontent)

zip_ref = zipfile.ZipFile('/tmp/student.zip', 'r')
zip_ref.extractall('/tmp/student/')
zip_ref.close()<jupyter_output><empty_output><jupyter_text>Load the datasets for grades in Maths and Portuguese<jupyter_code>df_mat = pd.read_csv('/tmp/student/student-mat.csv', delimiter=';')
df_por = pd.read_csv('/tmp/student/student-por.csv', delimiter=';')<jupyter_output><empty_output><jupyter_text>Have a brief look at the dataset content<jupyter_code>#Type code here
#Hint : use .info function<jupyter_output><empty_output><jupyter_text>Check if there are any outliers in the dataset<jupyter_code>#Type code here<jupyter_output><empty_output><jupyter_text>Convert categorical variables to one hot encoding, keep numerical vars as is.<jupyter_code>df_mat =                  #Type code here
df_mat.info()
### Binary categorical variables can be encoded using only 1 variable.
redundant_vars = [#Type Here] #Redundant variables are the one which have no relevance. 
                    #In this case variables like 'address_U',famsize_LE3'Pstatus_T'. Make a list of all such variables

#Drop Redundant Variables
#Type Code here<jupyter_output><empty_output><jupyter_text>Correlations for success in Maths<jupyter_code>#Create a correlation Matrix and separate the values of varible G3
corr_mat =                                          #Correlation Matrix
corr_mat_G3 = 
#Sort the above variable
#Type Code Here
#Get dummies for df_por
df_por = 
#Drop Redundant vars from df_por
#Type Code here
#print out first five rows of data
df_por.head()<jupyter_output><empty_output><jupyter_text>Correlations for success in Portuguese<jupyter_code>#Create correleation matrix for correlation of portuguese
corr_por = 
#Extract variable G3
corr_por_G3 = 
#Sort Values
#Type Code Here<jupyter_output><empty_output><jupyter_text>Train linear regression model on the Maths dataset<jupyter_code>#Import train_test_split, LinearRegression and MSE from resprctive libraries

#Define X(data to train on) and Y(target variable) from dataset
X_train, X_test, y_train, y_test = 
#Define linear regression model
model = 
#Fit model on training data<jupyter_output><empty_output><jupyter_text>Train set MSE<jupyter_code>#predict target values based on X_train
y_train_predict = 
#Calculate mean squared error
mse_train =
print(mse_train)<jupyter_output><empty_output><jupyter_text>Test set MSE<jupyter_code>#predict target variable based on X_test
y_test_predict = 
#Calculate mean squared error
mse_test = 
print(mse_test)<jupyter_output><empty_output><jupyter_text>Train decision tree regressor on the Maths dataset<jupyter_code>#Import DecisionTree library from respective library


#Define model 
model = 
#Fit the model in training data
#Type code here<jupyter_output><empty_output><jupyter_text>Train set MSE<jupyter_code>#Predict target variable on training data
y_train_predict = model.predict(X_train)
#Calculate mean squared error
mse_dt_train =           #Type code here
print(mse_dt_train)<jupyter_output><empty_output><jupyter_text>Test set MSE<jupyter_code>#Predict target variables on test data
y_test_predict = model.predict(X_test)
#Calculate mean squared error
mse_dt_test =           #Type code here
print(mse_dt_test)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08524027459954234, 'fraction_numerical': 0.003146453089244851, 'mean_word_length': 6.107723577235772, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '477690', 'license': 'MIT', 'n_tokens_mistral': 1185, 'n_tokens_neox': 1134, 'n_words': 301, 'path': 'Student Performance/Template.ipynb', 'repo_name': 'abhisngh/Data-Science', 'size': '3496'}