Tags » Python

Logistic Regression - Let's Classify Things..!!

In my post on Categorising Deep Seas of ML, I introduced you to problems of Classification (a subcategory of Supervised Learning).

But wait..we are talking Logistic “Regression”. 778 more words

Machine Learning

default dict in python/ dict of list in python

You can build it with list comprehension like this:

>>> dict((i, range(int(i), int(i) + 2)) for i in ['1', '2'])
{'1': , '2': }

And for the second part of your question use… 43 more words

Python

Pandas in Python - Basics

pandas is an open source Python library for data analysis. Python has always been great for prepping and munging data, but it’s never been great for analysis – you’d usually end up using… 870 more words

Pandas

Analysis and plotting of UK house prices

Introduction

This blog post attempts to analyse UK house price data from 2016 with multiple objective in mind

Cartopy

Internet of Things työpaja osa 1

Tekijät: Juuso Puroila, Leo Koskiluoma – Leon blogi projektista täällä: https://koskiluoma.wordpress.com/2017/03/23/iot-projekti-tomaattivahti-wip/

Työpajassa teemme kasvihuonetta tai muuta kasvatusympäristöä valvovaa sensoria, joka ilmankosteuden, lämpötilan tai mullan kosteuden raja-arvojen ylittyessä lähettää sähköpostin haluttuihin osoitteisiin. 180 more words

Python: Membuat Model Klasifikasi Support Vector Machines menggunakan Scikit-learn

Berikut merupakan teknik untuk membuat model prediksi menggunakan teknik Support Vector Machines.

from sklearn import datasets
from sklearn import svm
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
import _pickle as pickle
import requests, json

iris = datasets.load_iris()
X = iris.data
y = iris.target

X_train, X_test, y_train, y_test = train_test_split(X, y)

clf = svm.SVC()
clf.fit(iris.data, iris.target).predict(iris.data)

print("Accuracy = %0.2f" % accuracy_score(y_test, clf.predict(X_test)))
print(classification_report(y_test, clf.predict(X_test)))

pickle.dump(clf, open("iris_svm.pkl", "wb"))
my_support_vector_machines = pickle.load(open("iris_svm.pkl", "rb"))

print("Accuracy = %0.2f" % accuracy_score(y_test, my_support_vector_machines.predict(X_test)))
print(classification_report(y_test, my_support_vector_machines.predict(X_test)))
Python

Python: Membuat Model Klasifikasi Gaussian Naïve Bayes menggunakan Scikit-learn

Berikut merupakan teknik untuk membuat model prediksi menggunakan teknik Gaussian Naïve Bayes.

from sklearn import datasets
from sklearn.naive_bayes import GaussianNB
from sklearn.cross_validation import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
import _pickle as pickle
import requests, json

iris = datasets.load_iris()
X = iris.data
y = iris.target

X_train, X_test, y_train, y_test = train_test_split(X, y)

gnb = GaussianNB()
gnb.fit(iris.data, iris.target).predict(iris.data)

print("Accuracy = %0.2f" % accuracy_score(y_test, gnb.predict(X_test)))
print(classification_report(y_test, gnb.predict(X_test)))

pickle.dump(gnb, open("iris_gnb.pkl", "wb"))
my_gaussian_naive_bayes = pickle.load(open("iris_gnb.pkl", "rb"))

print("Accuracy = %0.2f" % accuracy_score(y_test, my_gaussian_naive_bayes.predict(X_test)))
print(classification_report(y_test, my_gaussian_naive_bayes.predict(X_test)))
Python