Skip to content

Instantly share code, notes, and snippets.

View philipphager's full-sized avatar

Philipp Hager philipphager

View GitHub Profile
@philipphager
philipphager / altair-example.ipynb
Created April 8, 2024 07:17
altair example.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def theme():
return {
"config": {
"title": {
"font": "serif",
"fontWeight": "normal",
"fontSize": 16,
},
"axis": {
"titleFont": "serif",
# Dependencies to install: Pandas for dataframes, pyarrow to support the feather file format.
# pip install pandas
# pip install pyarrow
# Load a downloaded dataset from file:
train_df = pd.read_feather("train.feather")
train_df.head()
# The dataset contains 220 features per query-document (columns starting with 'feature_*')
# Here is one of many ways to select all columns starting with 'feature_'
@philipphager
philipphager / example.py
Created April 11, 2023 15:08
mslr-web10k
# Dependencies to install. Pandas for dataframes, pyarrow to support the .parquet file format.
# pip install pandas
# pip install pyarrow
# Load a downloaded dataset from file:
train_df = pd.read_parquet("mslr_train.parquet")
train_df.head()
# The dataset contains 136 features per query-document (columns starting with 'feature_*')
# E.g. one way to select all columns starting with 'feature_'
{
"statistic": {
"postings": [
{
"doc_id": 0,
"tf": 1
}
],
"df": 1
},
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"data": {"name": "data-1132bb181f3c2cf775a80ccf83650219"},
"mark": "line",
"encoding": {
"color": {"field": "model", "type": "nominal"},
"row": {"field": "metric", "type": "nominal"},
"tooltip": [
{"field": "epoch", "type": "quantitative"},
{"field": "model", "type": "nominal"},
@philipphager
philipphager / spec.json
Created June 27, 2020 23:17
Vega-Lite spec from Sun Jun 28 2020
{
"config": {
"view": {"continuousWidth": 400, "continuousHeight": 300},
"axis": {
"labelFontSize": 14,
"labelFontWeight": "normal",
"titleFontSize": 14
},
"axisX": {"titlePadding": 20},
"axisY": {"titleFontWeight": "normal"},
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"hconcat": [
{
"mark": "bar",
"encoding": {
"tooltip": [
{"type": "quantitative", "field": "id"},
{"type": "nominal", "field": "name"},
{"type": "quantitative", "field": "loss"},
{
"config": {"view": {"continuousWidth": 400, "continuousHeight": 300}},
"hconcat": [
{
"mark": "bar",
"encoding": {
"tooltip": [
{"type": "quantitative", "field": "id"},
{"type": "nominal", "field": "name"},
{"type": "quantitative", "field": "loss"},
@philipphager
philipphager / AdjacencyList.java
Last active June 7, 2019 08:12
Simple GraphJet
package segments;
import java.util.*;
public class AdjacencyList {
private static final int[] NODE_THRESHOLDS;
static {
NODE_THRESHOLDS = new int[32];
NODE_THRESHOLDS[0] = 0;