Posts

Showing posts with the label Machine Learning

Simple Linear Regression Sample

###Python### # Importing the libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd # Importing the dataset dataset = pd.read_csv('Salary_Data.csv') X = dataset.iloc[:, :-1].values y = dataset.iloc[:, 1].values # Encoding categorical data # Encoding the Independat Variable ## Method 1 from sklearn.compose import ColumnTransformer from sklearn.preprocessing import OneHotEncoder ct = ColumnTransformer(transformers=[('encoder', OneHotEncoder(), [3])], remainder='passthrough') X = np.array(ct.fit_transform(X)) ## Method 2 """ from sklearn.preprocessing import LabelEncoder, OneHotEncoder labelencoder_X = LabelEncoder() x[:, 3] = labelencoder_X.fit_transform(x[:, 3]) onehotencoder = OneHotEncoder(categorical_features = [3]) X = onehotencoder.fit_transform(X).toarray() """ # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_tes...

Build a Data Model

5 methods of building models: 1. All-in 2. Backward Elimination 3. Forward Selection 4. Bidirectional Elimination 5. Score comparison P Value What is a p-value https://www.mathbootcamps.com/what-is-a-p-value/ How to Calculate P Value https://www.wikihow.com/Calculate-P-Value