Skip to content

Instantly share code, notes, and snippets.

View leriomaggio's full-sized avatar
🧙

Valerio Maggio leriomaggio

🧙
View GitHub Profile
@leriomaggio
leriomaggio / lazy_filter.md
Last active December 12, 2022 11:06
Functional Python Lazy Filtering pipeline

Case Study: Textual Data

Now it is time to crack on with our first case study 🙌.

Assume we have some data in textual format that we want to use as input to some ML model. To make it even more fun, instead of working with standard textual data, let's imagine we have some source code listings we want to process.

Our examplar data will be two functions, written in our most favourite programming language$^5$: init_random_weights_tensor, and init_random_weights_array:

[5]: Examples adapted from Learning PyTorch with Examples tutorial.

@leriomaggio
leriomaggio / borda.py
Last active December 16, 2022 16:42
Numpy based implementation of the Borda Selection Algorithm for Rankings
"""Python/Numpy implementation of the Borda Count"""
import numpy as np
from nptyping import NDArray
from typing import Tuple, Union, List, Any
RankingsList = Union[NDArray[(Any, Any), np.int], List[List[int]]]
Ranking = NDArray[(Any,), np.int]
Counts = NDArray[(Any,), np.int]
AveragePositions = NDArray[(Any,), np.float]
@leriomaggio
leriomaggio / solved-flower-hands-on-tutorial-pytorch.ipynb
Created June 19, 2023 04:08
SOLVED:Flower Hands-on Tutorial-PyTorch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.