Skip to content

Instantly share code, notes, and snippets.

View scidam's full-sized avatar
💭
I may be slow to respond.

Dmitry E. Kislov scidam

💭
I may be slow to respond.
View GitHub Profile
@scidam
scidam / rules.py
Last active August 2, 2017 03:31
Scoring rules in Python
# we assume the set of rules is a Python list;
# native Python set-type isn't suitable to store the rules
rules = [rule1, rule2, rule3]
def score(rule, *args, **kwargs):
# args, kwargs -- some additional parameters, if needed..
pass
# Implement score function for an individual rule here...
# It is highly recommended to use Pandas for such data processing problems
import pandas as pd
import numpy as np
dataset = {'feature1': np.random.rand(5000),
'feature2': np.random.rand(5000),
'feature3': np.random.rand(5000)
}
@scidam
scidam / sample.py
Last active September 8, 2018 09:35
'''
Hi, Nadeem!
Let's dive in deep how the most of clustering algorithms work. This allows us
to find what kind of encoding should be used to handle such categorical data.
If we consider hierarchical clustering algorithms, they use distances between
objects/items to be clustered and form groups according some linkage rules.
So, distances between objects are very important when do clustering.
import numpy as np
lat_min = 45.0
lat_max = 60.0
lon_min = 85.0
lon_max = 100.0
density = 3 # three points per `squared` degree
import numpy as np
np.random.seed(30) # for reproducibility, this line could be deleted
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"data = pd.read_clipboard(header=None)"
@scidam
scidam / numpy_minibatch_sgd.ipynb
Last active August 22, 2019 05:27
Pure Python/NumPy implementation of minibatch SGD method (simple example)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scidam
scidam / null
Last active January 17, 2020 04:45
try-r
# occurrence table plot -- species (load it from csv)
table1 <- read.table("table1.csv", sep=";")
table2 <- read.table("table2.csv", sep=";")
# talble of features sp -- feature (load data from csv)
# table2 <- cbind(c(1,1,0),c(0,0,1), c(0,1,0))
@scidam
scidam / model.py
Last active September 15, 2020 22:45
U-Net like CNN used to sovle windthrow detection and bark beetle outbreaks recognition problems
'''
Based on: https://www.kaggle.com/dingdiego/u-net-batchnorm-augmentation-stratification
U-Net: Convolutional Networks for Biomedical Image Segmentation
(https://arxiv.org/abs/1505.04597)
---
img_shape: (height, width, channels)
out_ch: number of output channels
start_ch: number of channels of the first conv
depth: zero indexed depth of the U-structure
class Node:
def __init__(self, value, type):
self.value = value
self.type = type
intervals = [[2, 10], [3, 7], [4, 7], [6, 8], [8, 9]]
nodes = list()
for interval in intervals:
nodes.append(Node(interval[0],'l'))
nodes.append(Node(interval[1],'r'))
cd /code
COM_PATH=/mnt/c/odm
for prjname in ussurisky;
do
cd /code
./run.sh --project-path $COM_PATH $prjname --max-concurrency 3 --dtm --dsm --use-exif --verbose
tar -C $COM_PATH --exclude=$prjname/images --exclude=$prjname/opensfm -zcvf $COM_PATH/$prjname.tar.gz $prjname