Skip to content

Instantly share code, notes, and snippets.

@marquisthunder
marquisthunder / lightgbm_rfe.py
Created March 10, 2023 05:25 — forked from c-bata/lightgbm_rfe.py
Recursive Feature Elimination for LightGBM. This class accepts missing values and Optuna LightGBM tuner.
import numpy as np
import pandas as pd
#import lightgbm as lgb
from optuna.integration import lightgbm as lgb
from sklearn.model_selection import train_test_split
from sklearn.utils import check_X_y, safe_sqr
from sklearn.feature_selection.base import SelectorMixin
from lightgbm import Booster
@marquisthunder
marquisthunder / pymc3-fosscon2017.ipynb
Created August 27, 2017 08:28 — forked from AustinRochford/pymc3-fosscon2017.ipynb
Open Source Bayesian Inference in Python with PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@marquisthunder
marquisthunder / BagOfLittleBootstraps.jl
Last active August 19, 2017 09:40 — forked from jiahao/BagOfLittleBootstraps.jl
Julia implementation of the Bag of Little Bootstraps (BLB) method (documented as, e.g., Algorithm 1 in arXiv:1112.5016) #BLB
using Distributions
export Measure, DiscreteMeasure, Estimator, EstimatorQuality,
blb, randsubset
abstract Measure
type DiscreteMeasure{S<:Number,T<:Number} <: Measure
points :: Vector{S}
weights :: Vector{T}
@marquisthunder
marquisthunder / create_bokeh_network.py
Last active November 14, 2021 16:15 — forked from luerhard/BokehGraph.py
[bokeh-nx]Script to create interactive bokeh networkx plots. #bokeh #networkx
import networkx as nx
from collections import namedtuple
from math import sqrt
import bokeh
from bokeh.models import HoverTool
from bokeh.plotting import show, figure
from bokeh.colors import RGB
import random
#corresponding package on pypi is confusingly called python-louvain
@marquisthunder
marquisthunder / maybe.py
Created July 6, 2016 23:58 — forked from senko/maybe.py
A Pythonic implementation of the Maybe monad
# maybe.py - a Pythonic implementation of the Maybe monad
# Copyright (C) 2014. Senko Rasic <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
@marquisthunder
marquisthunder / marisa_count_vectorizer.py
Last active August 19, 2017 09:36 — forked from kmike/marisa_count_vectorizer.py
[marisa_trie]marisa_count_vectorizer for sklearn #sklearn #trie
import numpy as np
import marisa_trie
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.externals import six
class MarisaCountVectorizer(CountVectorizer):
# ``CountVectorizer.fit`` method calls ``fit_transform`` so
# ``fit`` is not provided
def fit_transform(self, raw_documents, y=None):
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.
@marquisthunder
marquisthunder / pymc3
Created May 26, 2016 00:22 — forked from ceshine/pymc3
Bayesian Logistic Regression on the Kaggle Titanic dataset via PyMC3
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Bayesian Logistic Regression on the Kaggle titanic dataset"
]
},
{
@marquisthunder
marquisthunder / avazu_ftrl.go
Created May 26, 2016 00:22 — forked from ceshine/avazu_ftrl.go
Kaggle Avazu Challenge: FTRL-Proximal with L1 & L2 implemented in Go (single-threaded)
// Based on tinrtgu's Python script here:
// https://www.kaggle.com/c/avazu-ctr-prediction/forums/t/10927/beat-the-benchmark-with-less-than-1mb-of-memory
package main
import (
"encoding/csv"
"os"
"strconv"
"hash/fnv"
"math"