Machine Learning using python in 5 lines
when I asked my professor about machine learning he told the following:
Lets say you have a function f(a,b) = ax+by = z . Then there are sophisticated ways to learn a and b from a data set corresponding to [x,y,z]. This is (fitting in) machine learning.
So Here I am writing for someone who wants to use machine learning quickly in python:
First, let me write the general steps:
- Make the data in the right shape
- Create the learning object
- Fit the data using 1 & 2
- Predict on a new test data
Corresponding code
from sklearn.ensemble import RandomForestClassifier
[X,y] = extract_from_file('data_sheet.txt')#assuming you know #how to write this
function rf_classifier_object = RandomForestClassifier(max_depth=2, random_state=0)
rf_classifier_object.fit(X,y) #The Learning step
rf_classifier_object.predict(X_test)#This will predict the new X_test data
Now you may replace 'RF' with any classifier or regressor as you like. Let me know if you have any questions.
Posts
Visit to Weston Park Sheffield
Notes on Inverse transform sampling
Eigenvalues and poles
Back Prop Algorithm - What remains constant in derivatives
Wordpress to Jekyll Conversion
Phase functions
Solving Dynamical Systems in Javascript
Javascript on markdown file
Walking data
Walking, it is complicated
PRC
Isochrone
Walking, it's complicated
Newtons iteration as a map - Part 2
Newton's iteration as map - Part 1
ChooseRight
Mathematica for machine learning - Learning a map
Prediction and Detection, A Note
Why we walk ?
The equations that fall in love!
Oru cbi diarykkuripp(ഒരു സിബിഐ ഡയറിക്കുറിപ്പ്)
A way to detect your stress levels!!
In search of the cause in motor control
Compressive sensing - the most magical of signal processing.
Machine Learning using python in 5 lines
Can we measure blood pressure from radial artery pulse?
subscribe via RSS