Sorry For Inconvenience, Site is Under Maintenance. Please Goto HomePage

Structured Data Classification Fresco Play Handson Solutions

Structured Data Classification Fresco Play Handson Solutions
Notes Bureau

Structured Data Classification Fresco Play Hands-on Solutions

Disclaimer: The main motive to provide this solution is to help and support those who are unable to do these courses due to facing some issue and having a little bit lack of knowledge. All of the material and information contained on this website is for knowledge and education purposes only.


Try to understand these solutions and solve your Hands-On problems. (Not encourage copy and paste these solutions)

Structured Data Classification Fresco Play Handson Solutions


Course Path: Data Science/MACHINE LEARNING METHODS/Structured Data Classification

Suggestion: If you didn't find the question, Search by options to get a more accurate result.


Welcome to Structured Data Classification(75 Min)



File Name:Structured_test


Step 1: - 

import pandas as pd

import numpy as np

import dataframe as df


Step 2:- 

weather = pd.read_csv('weather.csv', sep=',')


Step 3:- 

data_size=weather.shape

print(data_size)

weather_col_names = list(weather.columns)

print(weather_col_names)

print(weather.describe())

print(weather.head(3))


Step 4:-

weather_target=weather['RainTomorrow'] 

print(weather_target)


Step 5:-

cols_to_drop = ['Date','RainTomorrow']

weather_feature = weather.drop(cols_to_drop,axis = 1)

print(weather_feature.head(5))


Step 6: -

weather_categorical = weather.select_dtypes(include=[object])

print(weather_categorical.head(15))


Step 7:- 

yes_no_cols = ["RainToday"]

weather_feature[yes_no_cols] = weather_feature[yes_no_cols] == 'Yes'

print(weather_feature.head(5))


Step 8:-

weather_dumm=pd.get_dummies(weather_feature, columns=["Location","WindGustDir","WindDir9am","WindDir3pm"], prefix=["Location","WindGustDir","WindDir9am","WindDir3pm"])

weather_matrix = weather_dumm.values.astype(np.float)


Step 9:- 

from sklearn.impute import SimpleImputer

imp=SimpleImputer(missing_values=np.nan,strategy='mean', fill_value=None,verbose=0,copy=True)

weather_matrix=imp.fit_transform(weather_matrix)


Step 10:-

from sklearn.preprocessing import StandardScaler

#Standardize the data by removing the mean and scaling to unit variance

scaler = StandardScaler()

#Fit to data, then transform it.

weather_matrix = scaler.fit_transform(weather_matrix)


Step 11:- 

from sklearn.model_selection import train_test_split

seed=5000

train_data,test_data, train_label, test_label = train_test_split(weather_matrix,weather_target,test_size=0.1,random_state = seed)


Step 12:- 

from sklearn.svm import SVC

classifier = SVC(kernel="linear",C=0.025,random_state=seed )

classifier = classifier.fit(train_data,train_label)

churn_predicted_target=classifier.predict(test_data)

score = classifier.score(test_data,test_label)

print('SVM Classifier : ',score)

with open('output.txt', 'w') as file:

    file.write(str(np.mean(score)))


Step 13:- 

from sklearn.ensemble import RandomForestClassifier

classifier = RandomForestClassifier(max_depth=5,n_estimators=10,max_features=10,random_state=seed)

classifier = classifier.fit(train_data,train_label)

churn_predicted_target=classifier.predict(test_data)

score = classifier.score(test_data,test_label)

print('Random Forest Classifier : ',score)

with open('output1.txt', 'w') as file:

    file.write(str(np.mean(score)))


If you want answers to any of the fresco play courses feel free to ask in the comment section, we will surely help.

2 comments

  1. I need to achieve 1.99 in fresco play I achieve only as of now 0.99 many of the courses comes hands on but I am unable to do in mobile
  2. Could you please help me with Python 3 - Functions and OOPs hands on and MCqs
Any comments and suggestion will be appreciated.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.

Join Telegram Channel

Join Notes Bureau Lets Teach and Learn

Join Telegram Channel
CLOSE ADS
CLOSE ADS