Skip to content

Instantly share code, notes, and snippets.

Avatar

Shihab Shahriar Khan Shihab-Shahriar

View GitHub Profile
@Shihab-Shahriar
Shihab-Shahriar / pyLOC.py
Last active Aug 16, 2020
Count total lines of Python code in a file or folder, excluding comments or empty lines.
View pyLOC.py
from io import StringIO
import tokenize, sys, os
import argparse
pref_skips = ('__', '.') # Skip folders that starts with ...
# From https://stackoverflow.com/a/2962727/4553309
def remove_comnts(source):
io_obj = StringIO(source)
@Shihab-Shahriar
Shihab-Shahriar / coarse_vs_fine.py
Last active Sep 8, 2019
performance of InstanceHardnessThreshold: Compares coarse parallelism using cross_val_predict with parallelizing estimator
View coarse_vs_fine.py
from collections import Counter
from time import perf_counter
import numpy as np
from sklearn.base import ClassifierMixin, clone
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold, cross_val_predict
from sklearn.utils import safe_indexing
from imblearn.under_sampling import InstanceHardnessThreshold
You can’t perform that action at this time.