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
module.exports = function(grunt) { | |
grunt.initConfig({ | |
}); | |
} |
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
grunt.initConfig({ | |
jshint: { | |
all:['sample.js'] | |
} | |
}); |
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
grunt.loadNpmTasks('grunt-contrib-jshint'); |
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 the features and labels | |
features = np.array(iris_dataset.data, dtype="float64") | |
labels = np.array(iris_dataset.target, dtype="float64") | |
# combine featutre with labels to shuffle the ordered data | |
data = np.column_stack((features, labels)) | |
np.random.shuffle(data) | |
# preparing dataset and label dataset | |
X = data[:, :-1] |
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 import datasets | |
import numpy as np | |
iris_dataset = datasets.load_iris() |
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
# training and testing set | |
from sklearn.model_selection import train_test_split | |
X_train, X_test, y_train, y_test = train_test_split(X,y, test_size=0.2) | |
# train the model | |
from sklearn import neighbors | |
clf = neighbors.KNeighborsClassifier(n_neighbors=5) | |
clf.fit(X_train, y_train) | |
# accuracy testing |
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 urllib.request import urlopen | |
# read the page | |
url = urlopen('http://www.cricbuzz.com/cricket-news/100707/destinys-child-zimbabwes-middle-order-batsman-sikandar-raza-treats-triumphs-and-failures-the-same') | |
html = url.read() | |
url.close() |
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
# create beautiful soup object and parse the html so we can use bs methods | |
import bs4 | |
bs = bs4.BeautifulSoup(html, 'html.parser') |
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
title = bs.title | |
# output - <title itemprop="name">Destiny's child, Raza treats triumphs and failures the same | Cricbuzz.com</title> |
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
title_text = title.getText() | |
# output - Destiny's child, Raza treats triumphs and failures the same | Cricbuzz.com |
OlderNewer