Skip to content

Instantly share code, notes, and snippets.


Shihab Shahriar Khan Shihab-Shahriar

View GitHub Profile
Shihab-Shahriar /
Last active Aug 16, 2020
Count total lines of Python code in a file or folder, excluding comments or empty lines.
from io import StringIO
import tokenize, sys, os
import argparse
pref_skips = ('__', '.') # Skip folders that starts with ...
# From
def remove_comnts(source):
io_obj = StringIO(source)
Shihab-Shahriar /
Last active Sep 8, 2019
performance of InstanceHardnessThreshold: Compares coarse parallelism using cross_val_predict with parallelizing estimator
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.