Machine Learning Tutorials

Types of Parameters in Line Plot in Seaborn 0

Types of Parameters in Line Plot in Seaborn

Program 1 import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns df_tips=pd.read_csv(“D://scikit_data/Billing/tips.csv”) df_tips sns.lineplot(x=’size’,y=’total_bill’,data=df_tips,hue=’day’,style=’day’,palette=’rocket’, dashes=False,legend=’brief’,markers=[‘.’,’*’,’>’,'<‘]) plt.title(“Bill Vs Size”) plt.xlabel(“Size”,fontsize=15) plt.ylabel(“Totl Bill”,fontsize=15) plt.show() df_tips.shape  

How to Draw Line Plot using Seaborn Github 0

How to Draw Line Plot using Seaborn Github

Program 1 # # Applcation of Seaborn Line plot using Seaborn gitgub import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns df_tips=sns.load_dataset(“tips”) df_tips.head() df_tips.info() df_tips.isnull().sum() df_tips.shape sns.lineplot(x=”tip”,y=”total_bill”,data=df_tips)...

How to Draw Line Plot in Seaborn 0

How to Draw Line Plot in Seaborn

Program 1 # # Application of SeaBorn import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #using Matplot lib days=[1,2,3,4,5,6,7,8,9,10] ind_temp=[34.4,23.4,45.4,24.4,34.4,36.2,44.4,33.2,28.7,33.5] plt.plot(days,ind_temp) plt.xlabel(“Days”); plt.ylabel(“Temperature”); plt.title(“Indore Temperature”) plt.show()...

Employee Retention Prediction in Logistic Regression in ML 0

Employee Retention Prediction in Logistic Regression in ML

Program 1 import pandas as pd from matplotlib import pyplot as plt df = pd.read_csv(“D://scikit_data/Employee/HR_comma_sep.csv”) df.head(10) left = df[df.left==1] left.shape left.shape left retained = df[df.left==0] retained.shape retained pd.crosstab(df.salary,df.left).plot(kind=’bar’) pd.crosstab(df.Department,df.left).plot(kind=’bar’) subdf = df[[‘satisfaction_level’,’average_montly_hours’,’promotion_last_5years’,’salary’]] subdf.head() salary_dummies...

Insurance Prediction in Logistic Regression in Machine Learning 0

Insurance Prediction in Logistic Regression in Machine Learning

Program 1 import pandas as pd import numpy as np from matplotlib import pyplot as plt df=pd.read_csv(“D://scikit_data/insurancedata/insurance_data.csv”) df.head(10) plt.scatter(df.age,df.bought_insurance,marker=’*’,color=’blue’) plt.show() from sklearn.model_selection import train_test_split x_train,x_test,y_train,y_test=train_test_split(df[[‘age’]],df.bought_insurance,test_size=0.1) len(x_train) x_train len(x_test) x_test from sklearn.linear_model import LogisticRegression model=LogisticRegression()...

How to Save Trained Model using Pickle in Machine Learning 0

How to Save Trained Model using Pickle in Machine Learning

Program 1 import pandas as pd import numpy as np from sklearn import linear_model import pickle df=pd.read_excel(“D://scikit_data/emp/employee.xlsx”) print(df) model=linear_model.LinearRegression() model.fit(df.drop(‘salary’,axis=’columns’),df.salary) print(model) print(“Predication with Model: “,model.predict([[7]])) print(“Coficient with Model: “,model.coef_) print(“Intercepet with Model: “,model.intercept_) myfile1=open(“pickle_model”,”wb”)...

Dummy Variables in Machine Learning 0

Dummy Variables in Machine Learning

Program 1 import pandas as pd # Version 2.2.2 import numpy as np # Version 1.24.3 import matplotlib.pyplot as plt # Version 3.7.1 import os from sklearn import linear_model # 1.5.11import df=pd.read_csv(“D://scikit_data\home/homeprices.csv”) print(df) df_dummi=pd.get_dummies(df.town)...