Coder Social home page Coder Social logo

ucsc-cse40's Introduction

UCSC CSE 40

Materials for UCSC's CSE 40 course taught by Dr. Lise Getoor and managed by the LINQS lab. This package is available on PyPi at ucsc-cse40.

Dependencies

This package is meant to be the sole direct dependency for CSE 40 students. Instead of specifying each dependency for students, this package defines the necessary dependencies to be installed along with it. So if you install this package (e.g. via pip), then it will also install all the necessary Python package dependencies for the course.

Working with the Autograder

All interfacing with the autograder is done via the autograder-py package. You should refer to the documentation for information on how to use it.

ucsc-cse40's People

Contributors

eriq-augustine avatar thachandrew avatar

Watchers

 avatar  avatar  avatar

Forkers

bytecate yuenmh

ucsc-cse40's Issues

Freebie Question

We should have a pre-made question type that just gives free points (a "freebie").

Feature request: pytest style testing

Summary

Testing system similar to pytest.

Motivation

I find that writing new tests in the grade_local.py file can be, to be frank, a little cumbersome, because of all the boilerplate code in the file deriving the base question class. I propose a system which uses the existing infrastructure to provide a more streamlined experience when writing tests, which would look something like the pytest API.

Details

The new addition is just a subclass of cse40.question.Question that loads all the functions in a file that are marked by a decorator. This can be added to the local grading script like this (taken from the HO3 one):

# grade_local.py
questions = [
    T1A("Task 1.A (drop_sparse_columns)", 1),
    T1B("Task 1.B (extract_numbers)", 1),
    T1C("Task 1.C (guess_types)", 1),
    T2A("Task 2.A (find_outliers)", 1),
    T2B("Task 2.B (merge_columns)", 1),
    T3A("Task 3.A (one_hot)", 1),
    T4A("Task 4.A (left_join)", 1),
    cse40.style.Style(path, max_points = 1),
    
    cse40.testing.TestFile(test_file_path), # <- this will run the tests in the file
    # The template could come with the path as Path(__file__).parent / "tests.py", which
    # could be an emptpy file in the template
]

The tests file would look something like this:

# tests.py
import cse40.testing
import pandas as pd
import numpy as np

# Not picked up as a test
def helper():
    ...

# This is picked up as a test
@cse40.testing.test
def drop_sparse_columns_returns_dataframe(submission, world_data):
    result = submission.drop_sparse_columns(world_data, 0.50)
    assert isinstance(result, pd.DataFrame)

The first argument to a test function is the submission, and all following args are filled with the corresponding values from additional_data. As you can see, the resulting API is actually not much different from the current one, it just lacks most of the visual noise, and also would use python asserts, which I feel are a bit more natural than testing with if statements.

My contribution

If the course staff/maintainers of this repo find this interesting, I would like to work on implementing it. Additionally if you would like to see a more concrete proposal I will be willing to clarify or code up a working example.

Type Checking Infrastructure

We should put in some infrastructure to make type checking easier.
We already check for NotImplemented, but it would be great to have methods like: check_float().
The method could check for NotImplemented, but then also check against all the common float types (float, numpy.float32, numpy.float64, etc), and then add a standardized message on error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.