Skip to content

Instantly share code, notes, and snippets.

View amansk2050's full-sized avatar
🎯
Code Fighting

Sheikh Aman amansk2050

🎯
Code Fighting
View GitHub Profile
@amansk2050
amansk2050 / Naive Bayes classifier
Created September 11, 2020 04:05
Naive Bayes approach without much optimization
#Import scikit-learn dataset library
from sklearn import datasets
#Load dataset
wine = datasets.load_wine()
# print the names of the 13 features
print("Features: ", wine.feature_names)
# print the label type of wine(class_0, class_1, class_2)
@amansk2050
amansk2050 / svm_classification
Created August 8, 2020 06:34
Support vector machine classification
# importing libraries
import numpy as nm
import matplotlib.pyplot as mtp
import pandas as pd
#importing datasets
data_set= pd.read_csv('/kaggle/input/iris-flower-dataset/IRIS.csv')
#Extracting Independent and dependent Variable
from sklearn.preprocessing import OrdinalEncoder
from sklearn.preprocessing import LabelEncoder
y=data_set['species'].astype(str)
@amansk2050
amansk2050 / Knn_classification
Created July 18, 2020 06:15
Knn classification in python
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv("/kaggle/input/iris-flower-dataset/IRIS.csv")
dataset.head()
Features=["sepal_length","sepal_width","petal_length","petal_width"]
X=dataset[Features]
y=dataset.species
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.3)
@amansk2050
amansk2050 / classification_random
Last active July 7, 2020 07:59
Classification code in random forest algorithm with scikit-learn , python
#importing basic library
import numpy as np
import pandas as pd
#loading dataset
data_frame= pd.read_csv('/kaggle/input/iris-flower-dataset/IRIS.csv')
#preparing data
feature=['sepal_length','sepal_width','petal_length','petal_width']
X=data_frame[feature]
y=data_frame.species
#dividing into train test set
@amansk2050
amansk2050 / random_forest_regression
Created July 6, 2020 16:17
Code of regression in Random Forest Algorithm in sklearn python
#importing libraries
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
from sklearn import metrics
import matplotlib.pyplot as plt
#load_dataset
dataset= pd.read_csv('/kaggle/input/usa-housing/USA_Housing.csv')
@amansk2050
amansk2050 / Decision_Tree_Classifier
Last active June 21, 2020 06:54
Code for decision tree classifier in Scikit-learn python.
#importing libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
#loading dataset
dataset = pd.read_csv("/kaggle/input/decision-tree-data-set-from-stack-abuse/bill_authentication.csv")
#data analysis
dataset.shape
dataset.head()
@amansk2050
amansk2050 / linear_regression.py
Last active June 14, 2020 17:30
Linear Regression in python
#import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as mtp
# loding data set
data=pd.read_csv("/kaggle/input/years-of-experience-and-salary-dataset/Salary_Data.csv")
#having a look on data set
data.head(15)
#extracting dependent and independent variables
Y=data["Salary"]