Posts

Setting up a Javascript experiment.

Image
Setting up a JavaScript Experiment Whenever I do an experiment for JavaScript, I set up an html file, and a javascript file. *The css file is just because I want it to be pretty, totally optional, but don't go overboard it isn't necessary for the experiment* Pictured below is the current project I'm working on, and I need to figure out how the 'Search' input works in google fonts.  I'm not going to be able to duplicate what google does to make this happen, so I need to find a way to do it myself.  I'm clueless as I write this, but that is where the experiment comes in. With Python, I'd run all the experiments in the command prompt / powershell / terminal.  Python does what it's gonna do in the system, that is where the process is run.  *Let's ignore Django exists yeah? Javascript on the other hand will have different reactions in a Browser, because the browser carries out it's own rules and interpretation of the code then t...

Python, a map, and a maze

Image
Python terminal maze So I was browsing the Learn Code the Hard Way Forum and came across the concept of making a map of x y coordinates, and realized I've never actually attempted something of that nature. So,  I fired up that Visual Studio Code ,  and had at it.  I'm trying to figure out why I've never attempted it before.  I think I might have just decided I wasn't ready for it and skipped on to less complicated things,  but today I really could see the fun in making a maze.  While running this prompt, for screen readers, to turn off the ascii just comment out the print_ascii() calls before and in the while loop. *The ascii map as imaged above may not print pretty in your command/terminal if the font is not the same as mine.  Change it however you want.* There are a ton of things you could modify and change.  For example, adding a system clear screen so that the map and instructions only appear at the top. You could add ascii c...

python statistics normal distribution continuous density

Image
Normal Distribution: Stats Class Code. Colorful wind chimes of bells and clay I was attempting to write the different formula's I would need for a normal distribution curve and the calculations we'd need for class.  There is a bit of success and a bit of failure in the code.  I may tweek it a bit more, so that someone could enter the a and b,  size of the curve, and the area range they want and it does the deviation, and mean calculations also, but this is enough for now. As always, drop a comment if you see anything wrong, or that needs improvement.  Take the code, practice, break it, build it, have fun learning. Lessons learned: Now for this bit of code, I was sure I could use the formula I found in this Khan video to write my own python function to find the probability in a range under a curve. Turns out, no, the math is way more complex for a continuous function. I am leaving my function and the way it uses the formula in the code block. I m...

Binomial deviation, mean, expected value, python Statistics class

Image
Binomials Deviation, Mean, Expected Value A pair of elder hands counting/sorting coins Another stellar explanation by this Khan Academy teacher: https://www.khanacademy.org/math/ap-statistics/random-variables-ap/binomial-mean-standard-deviation/v/finding-the-mean-and-standard-deviation-of-a-binomial-random-variable The code has comments, but I highly encourage watching the referenced video for understanding.  I still have to look up these Bernoulli variables, and maybe check out doing something pythonistic for that too.    So not much commentary on todays blog. GIMME THE CODE --start code block-- # Binomial mean, deviation import math import sys # reference= https://www.khanacademy.org/math/ap-statistics/random-variables-ap/binomial-mean-standard-deviation/v/expected-value-of-binomial-variable # Binomail random variable X, is understood as: # 1) A sample set is finite # 2) The success and fail probabilities are constant, they...

Stats class, binomial distribution Python

Image
A little background: For my statistics class at the local community college, the teacher has us plug numbers into Excel to get answers, because well, we don't need to learn to do the formula. I may be kinda a stickler about knowing the formula, while it's great Excel has a way to just plug in the numbers, I need to see the math.  I need to see and understand what's going on. I'll come back for more testing on this, and more explanation.  The link below for khan academy will do a far superior job at explaining the math than I can. Links I don't know about you all, but when I looked at the SciPy and Numpy links, I had a hard time following.  Also, the formulas and methods I found return an array or an object.  I just need the result of that big hairy formula.  I must not be googling correctly.  If anyone can link me to the method in either one of these that just returns the results of that binomial distribution formula, it'd be much appreciate...

Python, excel, pandas, write an excel file to a panda's database

Image
Using Python, Pandas and Excel to create my database I started writing a new set of python class's for the machine learning experiment. With the original code I found that I was coding all the decisions that were being made.  Now while it functioned fine, the point of getting the machine to do the work was lost. So the new one started trying to figure out how to make it quicker, reusable, and the data modifiable. The decision tree needed something to work with besides the hard coded solution.  This is where pandas and excel will come in. Below the bad descisions section is the new code.  Feel free to scroll down if that's what your here for. Image: Pandas in action. Compacted terminal print of the columns of data labeled: size, seed_type, [...], ornaments, colors, names.   The rows are identified by number only.  1 - 8.  These identifiers in the column will help the new decision tree eliminate what plant we are describing down to a list of n...

statistics python standard deviations

I showed my statistics teacher my python file for making stem and leaf plots, and asked her if I could use the python programs I write on my stat's tests.   I was worried she'd say no, but if she didn't want me to use them, I could manage, and I would still be making them anyways, because this helps me learn.  This is a file with three different methods/functions in it that can find your Standard Deviation of a Sample, and Standard Deviation of a Population and the z-score of a value. # Scroll to the bottom if you just want the code# Explanation:  The math is not easy to explain, but basically, you want to know: Deviation is the normal difference between the numbers in the data set and the center value - mean of all those numbers. Mean vs Median:  mean is the center value of all those integers like average   median is the center data point. (which may not be a value that is close to the average/mean.   Sample vs Population: If we wante...