(Python Example for Beginners)
Write a Python program to calculate the standard deviation of the following data.
import math import sys def sd_calc(data): n = len(data) if n <= 1: return 0.0 mean, sd = avg_calc(data), 0.0 # calculate stan. dev. for el in data: sd += (float(el) - mean)**2 sd = math.sqrt(sd / float(n-1)) return sd def avg_calc(ls): n, mean = len(ls), 0.0 if n <= 1: return ls # calculate average for el in ls: mean = mean + float(el) mean = mean / float(n) return mean data = [4, 2, 5, 8, 6] print("Sample Data: ",data) print("Standard Deviation : ",sd_calc(data))
Sample Data: [4, 2, 5, 8, 6] Standard Deviation : 2.23606797749979
Python Example – Write a Python program to calculate the standard deviation of the following data
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.
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.