Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻

Valerio Maggio leriomaggio

👨‍💻
View GitHub Profile
@leriomaggio
leriomaggio / multiprocessing_seed_numpy.py
Last active Apr 11, 2021
Python and Random State Sharing with NumPy and PyTorch, depending on different multiprocessing start method (i.e. fork vs spawn)
View multiprocessing_seed_numpy.py
import numpy as np
import multiprocessing as mp
from argparse import ArgumentParser
def get_current_seed(wid):
s = np.random.get_state()[1][0]
print(f"Pool Worker {wid}: Random State {s}")
@leriomaggio
leriomaggio / pytrousse_protocol_data_pipeline_with_validation.py
Last active Oct 23, 2020
PyTrousse Protocol-based Data Pipeline with Simple Validation Algorithm
View pytrousse_protocol_data_pipeline_with_validation.py
from typing import Tuple, List, Optional, Union, NewType
from typing import Protocol, runtime_checkable
from abc import ABC, abstractmethod
import pandas as pd
try:
import torch as t
from torch import Tensor as Tensor
except ImportError: # fallback to Numpy, if torch not available - this is just as a POP!
import numpy as t
from numpy import ndarray as Tensor
@leriomaggio
leriomaggio / borda.py
Last active Jun 15, 2020
Numpy based implementation of the Borda Selection Algorithm for Rankings
View borda.py
"""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]
View umap_inverse_transform_future_warning.py
import umap
import numpy as np
import scipy as sp
print('umap: ', umap.__version__)
print('Numpy: ', np.__version__)
print('Scipy: ', sp.__version__)
# umap: 0.4.0
# Numpy: 1.17.5
@leriomaggio
leriomaggio / kale-euroscipy.md
Last active Sep 4, 2019
Kubeflow Kale: from Jupyter Notebook to Complex Pipelines
View kale-euroscipy.md

Kubeflow Kale: from Jupyter Notebook to Complex Pipelines

Abstract

In this talk I will present a new solution to automatically scale Jupyter notebooks to complex and reproducibility pipelines based on Kubernetes and KubeFlow.

Description

Nowadays, most of the High Performance Computing (HPC) tasks are carried out in the Cloud, and this is as much

@leriomaggio
leriomaggio / pyconx_conference_talks_ranking.md
Last active Feb 10, 2019
PyConX Conference Talks Ranking
View pyconx_conference_talks_ranking.md
import pandas as pd
import numpy as np
from IPython.display import HTML 
@leriomaggio
leriomaggio / MSCX-Tutorial.md
Last active Aug 31, 2018
NetworkX Tutorial @ MSCX - Setup Instructions
View MSCX-Tutorial.md

Network Analysis Tutorial using Python & networkx

MSCX Ph.D. Summer School, Salina (ME) - Italy

Author: Valerio Maggio

PostDoc Data Scientist @ FBK/MPBA

@leriomaggio
leriomaggio / pycon7_conference_talk_rankings.md
Last active Feb 2, 2016
Community Voting Results and Rankings of Talks proposed at PyCon Sette: http://pycon.it #PyDataIt #DjangoVillage
View pycon7_conference_talk_rankings.md
import pandas as pd
import numpy as np
@leriomaggio
leriomaggio / pydata_program.md
Last active Aug 29, 2015
PyData 2014 Berlin Program
View pydata_program.md

#PyData Berlin Program, 2014

Friday, July 25

Time Beginner/Intermediate Tutorial Intermediate/Advanced Tutorial
12:00-12:45 Registration Registration
-- -- -- -- -- -- -- -- -- --
12:45-14:05 Frank Kaufer (bakdata) Bryan Van De Ven (Continuum Analytics)
Python and Big Data Framework Interactive Plots using Bokeh