Skip to content

Instantly share code, notes, and snippets.

View adam2392's full-sized avatar
🎯
Focusing

Adam Li adam2392

🎯
Focusing
View GitHub Profile
@adam2392
adam2392 / ballot.sol
Created September 22, 2018 19:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
@adam2392
adam2392 / gist:78519091104cecfeb8ff796eac7e8115
Created January 11, 2022 20:09
Comparing Axis-aligned and Oblique trees
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@adam2392
adam2392 / gist:964a2b9da09525c23068324eb6fc72ee
Created January 25, 2024 21:21
Benchmarking ExtraTree PR with missing-values
"""Instructions
1. Build this PR and run:
```bash
python bench_missing_extratrees.py bench ~/bench_results pr_no_pythoncheck
```
2. On main run:
```bash
@adam2392
adam2392 / gist:f283d5e6a2e8408a6f187a3079990674
Created January 25, 2024 21:36
Benchmarking ExtraTreesForest PR with missing-values
"""Instructions
1. Build this PR and run:
```bash
python bench_missing_extraforest.py bench ~/bench_results_forest pr
```
2. On main run:
```bash
from sklearn.ensemble import RandomForestClassifier
from sklearn.datasets import make_classification
n_samples = 10_000
n_features = 200
n_estimators = 200
# Generate synthetic classification dataset
X, y = make_classification(n_samples=n_samples, n_features=n_features, n_classes=2, random_state=42)
@adam2392
adam2392 / gist:a9988e3036ec4a01ee2fe60f3d142b5b
Created March 21, 2024 14:55
Runtime and sizes benchmark
"""Instructions
1. Build this PR and run:
```bash
python bench_randomforest.py bench ~/bench_results_forest pr
```
2. On main run:
```bash
@adam2392
adam2392 / gist:acb235a94b8dc2ae9655fbd30b00dbb8
Created July 2, 2024 12:32
Benchmark data with missing values - `ExtraTrees*`
"""Instructions
1. Build this PR and run:
```bash
python bench_missing_extraforest.py bench ~/bench_results_forest pr
```
2. On main run:
```bash
@adam2392
adam2392 / gist:38d9a275224d85607ea4a6b842fa7ca0
Created July 2, 2024 12:34
Benchmark on data with missing-values on `ExtraTree*`
"""Instructions
1. Build this PR and run:
```bash
python bench_missing_extratrees.py bench ~/bench_results pr_no_pythoncheck
```
2. On main run:
```bash
@adam2392
adam2392 / gist:c3fb6f14100e9de1efd1d17f6122018a
Created October 15, 2024 20:00
Encoder and Decoder for MNIST
import numpy as np
import torch
import torch.nn as nn
class ResidualBlock(nn.Module):
def __init__(self, latent_dim, inner_dim):
super(ResidualBlock, self).__init__()
self.fc1 = nn.Linear(latent_dim, inner_dim)
self.fc2 = nn.Linear(inner_dim, inner_dim)