This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.linear_model import LogisticRegression | |
from sklearn.linear_model import LinearRegression | |
import pandas as pd | |
import numpy as np | |
df = pd.read_csv('W.csv',sep = ',') | |
df['Height']= df.Height*2.54 | |
df['Weight'] = df.Weight*0.45 | |
Gender = df[df.columns[0]] | |
HW = df[df.columns[1:3]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import exp,array,random,dot | |
class NeuralNetwork(): | |
def __init__(self): | |
random.seed(1) | |
self.synaptic_weights = 2* random.random((3,1))-1 | |
def __sigmoid(self,x): | |
return 1/(1+exp(-x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.metrics.pairwise import linear_kernel | |
ds = pd.read_csv("sample-data.csv") | |
tf = TfidfVectorizer(analyzer='word', ngram_range=(1, 3), min_df=0, stop_words='english') | |
tfidf_matrix = tf.fit_transform(ds['description']) | |
cosine_similarities = linear_kernel(tfidf_matrix, tfidf_matrix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from difflib import get_close_matches | |
data = json.load(open("data.json")) | |
def translate(word): | |
word = word.lower() | |
if word in data: | |
return data[word] | |
elif word.title() in data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from sklearn.preprocessing import Imputer | |
from sklearn.neighbors import KNeighborsClassifier | |
from sklearn.metrics import accuracy_score | |
import pandas as pd | |
from sklearn import cross_validation | |
veri = pd.read_csv("cancer.data") | |
veri.replace("?",-99999,inplace=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get current date in required format | |
import datetime | |
# store the birthdates of your contacts | |
import json | |
from selenium import webdriver | |
# add a delay so that all elements of | |
# the webpage are loaded before proceeding |