All Projects → koaning → Memo

koaning / Memo

Licence: mit
Decorators that help you remember.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Memo

Gridcal
GridCal, a cross-platform power systems solver written in Python with user interface and embedded python console
Stars: ✭ 197 (+479.41%)
Mutual labels:  simulation, grid
React Native Super Grid
Responsive Grid View for React Native
Stars: ✭ 971 (+2755.88%)
Mutual labels:  grid
Swiftui Grid
🚀 SwiftUI Grid layout with custom styles
Stars: ✭ 872 (+2464.71%)
Mutual labels:  grid
Cellsim 2
Simulating complete lives of different cellular animals and plants. Evolution, inheritance, predation and more.
Stars: ✭ 28 (-17.65%)
Mutual labels:  simulation
Ascollectionview
A SwiftUI collection view with support for custom layouts, preloading, and more.
Stars: ✭ 878 (+2482.35%)
Mutual labels:  grid
Jomini
Historical battle simulation package for Python
Stars: ✭ 31 (-8.82%)
Mutual labels:  simulation
Metta
An information security preparedness tool to do adversarial simulation.
Stars: ✭ 867 (+2450%)
Mutual labels:  simulation
Baseliner
All your baseline are belong to us
Stars: ✭ 35 (+2.94%)
Mutual labels:  grid
React Base Table
A react table component to display large datasets with high performance and flexibility
Stars: ✭ 966 (+2741.18%)
Mutual labels:  grid
Tko Electronics Sim
A cross-platform app that allows for building and simulating FRC electronics in real time.
Stars: ✭ 28 (-17.65%)
Mutual labels:  simulation
Workcraft
Toolset to capture, simulate, synthesize and verify graph models
Stars: ✭ 27 (-20.59%)
Mutual labels:  simulation
Thrive
The main repository for the development of the evolution game Thrive.
Stars: ✭ 874 (+2470.59%)
Mutual labels:  simulation
React Grid Carousel
React responsive carousel component w/ grid layout
Stars: ✭ 29 (-14.71%)
Mutual labels:  grid
Gym Alttp Gridworld
A gym environment for Stuart Armstrong's model of a treacherous turn.
Stars: ✭ 14 (-58.82%)
Mutual labels:  simulation
Higan Verilog
This is a higan/Verilator co-simulation example/framework
Stars: ✭ 35 (+2.94%)
Mutual labels:  simulation
Vue2 Datatable
The best Datatable for Vue.js 2.x which never sucks. Give us a star 🌟 if you like it! (DEPRECATED. As I, @kenberkeley, the only maintainer, no longer works for OneWay. Bugs may be fixed but new features or breaking changes might not be merged. However, it's still the best in my mind because of its extremely flexible usage of dynamic components)
Stars: ✭ 867 (+2450%)
Mutual labels:  grid
Facsimile
Facsimile Simulation Library
Stars: ✭ 20 (-41.18%)
Mutual labels:  simulation
Blazm.components
A few useful and awesome components for Blazor. Blazor + awesome (azm)=Blazm (Blossom)
Stars: ✭ 29 (-14.71%)
Mutual labels:  grid
Pioneer
A game of lonely space adventure
Stars: ✭ 979 (+2779.41%)
Mutual labels:  simulation
Blog
在这里写一些工作中遇到的前端,后端以及运维的问题
Stars: ✭ 974 (+2764.71%)
Mutual labels:  grid

Installation

pip install memo

Documentation

The documentation can be found here.

The quickstart guide is found here.

Usage

Here's an example of utility functions provided by our library.

import numpy as np 
from memo import memlist, memfile, grid, time_taken

data = []

@memfile(filepath="results.jsonl")
@memlist(data=data)
@time_taken()
def birthday_experiment(class_size, n_sim):
    """Simulates the birthday paradox. Vectorized = Fast!"""
    sims = np.random.randint(1, 365 + 1, (n_sim, class_size))
    sort_sims = np.sort(sims, axis=1)
    n_uniq = (sort_sims[:, 1:] != sort_sims[:, :-1]).sum(axis = 1) + 1
    proba = np.mean(n_uniq != class_size)
    return {"est_proba": proba}

for settings in grid(class_size=[5, 10, 20, 30], n_sim=[1000, 1_000_000]):
    birthday_experiment(**settings)

The decorators memlist and memfile are making sure that the keyword arugments and dictionary output of the birthday_experiment are logged. The contents of the results.jsonl-file and the data variable looks like this;

{"class_size": 5, "n_sim": 1000, "est_proba": 0.024, "time_taken": 0.0004899501800537109}
{"class_size": 5, "n_sim": 1000000, "est_proba": 0.027178, "time_taken": 0.19407916069030762}
{"class_size": 10, "n_sim": 1000, "est_proba": 0.104, "time_taken": 0.000598907470703125}
{"class_size": 10, "n_sim": 1000000, "est_proba": 0.117062, "time_taken": 0.3751380443572998}
{"class_size": 20, "n_sim": 1000, "est_proba": 0.415, "time_taken": 0.0009679794311523438}
{"class_size": 20, "n_sim": 1000000, "est_proba": 0.411571, "time_taken": 0.7928380966186523}
{"class_size": 30, "n_sim": 1000, "est_proba": 0.703, "time_taken": 0.0018239021301269531}
{"class_size": 30, "n_sim": 1000000, "est_proba": 0.706033, "time_taken": 1.1375510692596436}

The nice thing about being able to log results to a file or to the web is that you can also more easily parallize your jobs!

Features

This library also offers decorators to pipe to other sources.

  • memlists sends the json blobs to a list
  • memfile sends the json blobs to a file
  • memweb sends the json blobs to a server via http-post requests
  • memfunc sends the data to a callable that you supply, like print
  • grid generates a convenient grid for your experiments
  • random_grid generates a randomized grid for your experiments
  • time_taken also logs the time the function takes to run

Check the API docs here for more information on how these work.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].