This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import pandas as pd | |
import itertools | |
import time | |
import multiprocessing | |
from typing import Callable, Tuple, Union | |
def groupby_parallel(groupby_df: pd.core.groupby.DataFrameGroupBy, | |
func: Callable[[Tuple[str, pd.DataFrame]], Union[pd.DataFrame, pd.Series]], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from mxnet import init | |
from mxnet.gluon import nn | |
from mxnet.gluon.model_zoo.custom_layers import HybridConcurrent, Identity | |
def sigma(kernel_size, channels): | |
return math.sqrt(2. / (kernel_size * kernel_size * channels)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
# http://weibo.com/1915548291/CqcYV0Ga3 | |
# 1到n个人排成一圈,从编号为1的人开始,依次说白,黑,白,黑,。。。,说到黑的人离队,问最后留下编号为几的人。 | |
def who_is_the_lucky_dog(n): | |
if n < 1: | |
return 'n must be greater than 0' | |
elif n == 1: | |
return 1 |