Sitelet https://github.com/denisecase/datafun-06-ml
Skip to content

Repository files navigation

datafun-06-ml

Workflow Guide Python 3.14 uv managed ty type checked Ruff Jupyter marimo Zensical docs MIT

Professional Python project: linear regression and predictive analytics.

Project Goal

This project introduces linear regression, the process of fitting a model to data and using it to make predictions.

Think about two variables that might be related:

  • Does study time predict exam scores?
  • Does temperature predict energy usage?
  • Does advertising spend predict revenue?

Your goal: run the example, read the code, and apply the same approach to a dataset and question of your own choosing.

For data suggestions, please see data/raw/README.md.

Standard Process

OBSERVE
DECLARE
PREPARE
SPLIT
BASELINE
TRAIN
PREDICT
EVALUATE
VISUALIZE
ASSESS

Example:

TRAIN       LinearRegression
PREDICT     on X_test
EVALUATE    baseline vs model on y_test

Important Folders and Files

  • data/raw - raw data
  • docs/ - project narrative and documentation\
  • src/datafun - supporting Python code
  • pyproject.toml - project configuration
  • zensical.toml - documentation configuration

Common Workflow

Follow the step-by-step workflow guide carefully.

Success

After completing Phase 1. Start & Run, you'll have the example project, running on your machine. A new file project.log will appear in the root project folder and running the example script will print out:

===================================
END main() - Executed successfully!
===================================

Command Reference

The commands below are used in the workflow guide above. They are provided here for convenience.

Follow the guide for the full instructions.

Show command reference

In a machine terminal (open in your Repos folder)

Open a machine terminal in your Repos folder:

git clone https://github.com/denisecase/datafun-06-ml

cd datafun-06-ml
code .

In a VS Code terminal

These are listed for convenience. For best results, follow the detailed instructions in pro-analytics-02 guide.

Use VS Code menu option Terminal / New Terminal to open a VS Code terminal in the root project folder. Copy each command, paste into your terminal, and hit ENTER, to run each command one at a time.

uv self update
uv python pin 3.14

uv python install
uv lock --upgrade
uv sync

uv run pre-commit install
uv run pre-commit autoupdate

git add -A
uv run pre-commit run --all-files
# repeat if changes were made by pre-commit tasks
git add -A
uv run pre-commit run --all-files

# run the penguin example: is there a linear relationship?
uv run python -m datafun.app

# do chores
uv run ruff format .
uv run ruff check . --fix
uv run ty check
uv run python -m pytest
uv run python -m zensical build

# save progress as you work
git add -A
git commit -m "your message here"
# repeat if changes were made (try the UP ARROW)
git add -A
git commit -m "your message here"

git push -u origin main

Helpful Tips

  • Use the UP ARROW and DOWN ARROW in the terminal to scroll through past commands.
  • Use CTRL+f to find (and replace) text within a file.

Much Can Be Ignored

  • You do not need to add to or modify tests/. Tests are recommended and provided for example only.
  • Many files are silent helpers. Explore as you like, but most files are never touched.
  • You do NOT need to understand everything; let understanding build over time.

As Needed

If VS Code does not automatically use the new .venv environment:

  1. Open the Command Palette (Ctrl+Shift+P).
  2. Run Python: Select Interpreter.
  3. Select the interpreter from this project's .venv folder.

If VS Code still does not recognize the environment or newly installed tools:

  1. Open the Command Palette (Ctrl+Shift+P).
  2. Run Developer: Reload Window.

Troubleshooting >>>

If you see something like this in your terminal: >>> or ... You accidentally started Python interactive mode. It happens. Press Ctrl c (both keys together) or Ctrl+Z then Enter on Windows.

Documentation

Data Card

Annotations

Citation

License

This project is licensed under the MIT License.

About

Professional Python project: linear regression and predictive analytics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages