Skip to content

Instantly share code, notes, and snippets.

Anatoly Levchik mirth

Block or report user

Report or block mirth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View levchik_folds.py
import os
import numpy as np
import pandas as pd
from sklearn.model_selection import StratifiedKFold
prod_to_cat = pd.read_csv('levchik_folds/prod_to_category.csv')
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=4242)
split = skf.split(prod_to_cat.drop('category_id', axis=1), prod_to_cat['category_id'])
View visitor
#include <functional>
#include <boost/mpl/inherit_linearly.hpp>
#include <boost/mpl/inherit.hpp>
#include <boost/mpl/vector.hpp>
template<typename TargetsVector, typename SignatureVector>
struct visit_method;
template<typename TargetType, typename ReturnType, typename ... ArgsTypes>
struct visit_method<TargetType, std::tuple<ReturnType, ArgsTypes ...>> {
View visitor.cpp
#include <iostream>
#include <memory>
#include <vector>
#include "visitor.hpp"
struct foo;
struct bar;
using visitor_t = basic_visitor<std::tuple<foo, bar>, void(int)>;
@mirth
mirth / tuple_to_strings.cpp
Created Apr 20, 2016 — forked from mumreg/tuple_to_strings.cpp
Strings formating approach
View tuple_to_strings.cpp
#include <iostream>
#include <cstddef>
#include <tuple>
#include <utility>
#include <sstream>
#include <vector>
template <typename Tuple, typename F, std::size_t ...Indices>
void for_each_impl(Tuple&& tuple, F&& f, std::index_sequence<Indices...>) {
using swallow = int[];
View russian_obscene_vocabulary.txt
6ля
6лядь
6лять
b3ъeб
cock
cunt
e6aль
ebal
eblan
eбaл
@mirth
mirth / import_from_parent.py
Last active Aug 29, 2015
This gist adds parent directory to sys.path to be able import files from parent directory.
View import_from_parent.py
if __name__ == '__main__' and __package__ is None:
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
View lexer.rb
# encoding: utf-8
# Processor of Link Grammar for Russian output.
#
class LinkParser::Lexer
# This exception raises when link grammar is invalid and Lexer
# is unable to understand the output.
#
class InvalidLinkGrammar < RuntimeError
attr_reader :input
You can’t perform that action at this time.