from sklearn import datasets import numpy as np from sklearn.cross_validation import train_test_split from sklearn.preprocessing import StandardScaler
iris = datasets.load_iris() X = iris.data y = iris.target
Split Data For Cross Validation
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
Standardize Feature Data
sc = StandardScaler() sc.fit(X_train) X_train_std = sc.transform(X_train) X_test_std = sc.transform(X_test)
array([[ 6.1, 2.8, 4.7, 1.2], [ 5.7, 3.8, 1.7, 0.3], [ 7.7, 2.6, 6.9, 2.3], [ 6. , 2.9, 4.5, 1.5], [ 6.8, 2.8, 4.8, 1.4]])
array([[ 0.3100623 , -0.49582097, 0.48403749, -0.05143998], [-0.17225683, 1.92563026, -1.26851205, -1.26670948], [ 2.23933883, -0.98011121, 1.76924049, 1.43388941], [ 0.18948252, -0.25367584, 0.36720086, 0.35364985], [ 1.15412078, -0.49582097, 0.54245581, 0.21861991]])
Python Example for Beginners
Two Machine Learning Fields
There are two sides to machine learning:
- Practical Machine Learning:This is about querying databases, cleaning data, writing scripts to transform data and gluing algorithm and libraries together and writing custom code to squeeze reliable answers from data to satisfy difficult and ill defined questions. It’s the mess of reality.
- Theoretical Machine Learning: This is about math and abstraction and idealized scenarios and limits and beauty and informing what is possible. It is a whole lot neater and cleaner and removed from the mess of reality.
Data Science Resources: Data Science Recipes and Applied Machine Learning Recipes
Introduction to Applied Machine Learning & Data Science for Beginners, Business Analysts, Students, Researchers and Freelancers with Python & R Codes @ Western Australian Center for Applied Machine Learning & Data Science (WACAMLDS) !!!
Latest end-to-end Learn by Coding Recipes in Project-Based Learning:
Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.