Python and AI Class

@Josh_Melnick @Team_VCC

We’ll cover the basis of setting up python, building data models from the DMS weather station (given its still working) in influxdb, and would be diving into modules like keras, jupyter notebook, and pytorch.

https://calendar.dallasmakerspace.org/events/view/13930

Check it out of you like; I know we’ll be having a lot of fun diving into this together. If there’s enough interest we could continue it on into a weekend hackathon as a group project.

Bonus round; value add to DMS:

1 Like

Damn, wish I hadn’t missed the boat on this. Sounds very fun

1 Like

The Weather Station, located on the roof of DMS, is currently nonfunctional. It was blown over by strong winds several months ago.

@dariosaur Still going on!

Currently scheduled for Sept 13 but is there a better day for everyone?

darn… we can pull in other datasets but I’d be glad to fix that station up.

Could someone with roof access bring it down so it can be repaired? There is a second ask that once repair we can get it back up there?

The Weather Station belongs to Science. Suggest you check with them first.

What do you mean setting up Python like downloading and IDE or anaconda? Jupyter Notebooks is easier for newbies I think.

We dont need a weather station could just use a free weather API

We can get free data sets for ML from Kaggle

95% of the work of ML is wrangling the data and filling in NaN values with either interpolation or nearest neighbor or the mean of the data in a particular column, that is the work is the intuitive Data Science.

to quote myself:

and would be diving into modules like keras, jupyter notebook, and pytorch.

Did not knew about kaggle that is a great idea.

As for the weather station… we may want to get up there and pull it down if we’re not going to repair it though.

It said registration was closed when I looked, but I’ll check back later.

It was closed for me too.

Odd, went to check on it and it said there was a fee to students and honorarium. I didn’t submit it as such but I corrected it:

https://calendar.dallasmakerspace.org/events/view/13930

Should be available in the next 48 hours.

1 Like

How does the online compiler work how do you use libraries? Never mind I figured it out.

1 Like

yeah under the hood there’s a linux docker container. so it has GCC, pip, and the usual gnu tools. but I bet it was a lot more fun “hacking” at it to figure it out.

1 Like

Since there has not been enough interest in the class, tonight’s session is cancelled.

A better course option for attendees would be:

Which is usually a $200 class that is being offered for $10.99 and is extremely worth taking.

1 Like

It quoted me a couple dollars more and had a 30 day money back guarantee so I signed up. Thanks for the link. I had joked that I had learned so many languages before retirement and I would not take on another. But every time I see the power of Python, I was impressed.

1 Like

I know what you mean, just was doing some monte carlo modeling earlier today for the probability if someone would call a rideshare given they’re walking more than 4 blocks away from “home”.

In C that’s a few hundred lines of code.

Python…

# coding: utf-8
"""
Models a person going 'x' blocks from home and probability of a rideshare being called.
"""

from random import choice as choose

DIRECTIONS = {
    "North": (0, 1),
    "South": (0, -1),
    "East": (1, 0),
    "West": (-1, 0),
}

def rand_walk(iterations):
    """
    Random walking on a grid with reverse paths allowed
    """

    grid_x, grid_y = 0, 0

    for _ in range(iterations):

        (grid_dx, grid_dy) = choose([
            DIRECTIONS['North'],
            DIRECTIONS['South'],
            DIRECTIONS['East'],
            DIRECTIONS['West']
        ])

        grid_x += grid_dx
        grid_y += grid_dy

    return (grid_x, grid_y)

def model(num_of_walks, max_blocks):
    """
    Calculate model
    """

    for walk_len in range(1, max_blocks):
        no_transport = 0

        for _ in range(num_of_walks):
            (grid_x, grid_y) = rand_walk(walk_len)
            distance = abs(grid_x) + abs(grid_y)
            if distance <= 4:
                no_transport += 1

        no_transport_percentage = float(no_transport) / num_of_walks
        print("Walk size = ", walk_len,
              " / % of no transport = ", 100 * no_transport_percentage)

def main():
    """
    Do the things
    """

    for _ in range(25):
        walk = rand_walk(10)
        print(walk, "Distance from home = ", abs(walk[0]) + abs(walk[1]))

    for walks in (100, 10000):
        model(num_of_walks=walks, max_blocks=31)

if __name__ == '__main__':
    main()

# vim: set sts=4 ts=4 et number list:

Less than 70 but that’s also with comments for help(), readability, and prep as an importable module (ie ready to be published via pip). Plus one can add in a quick genetic algorithm and randomizer in about another 10 lines.

The really fun part for this greybeard is the rand_walk function can be used in game development.

1 Like