partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
show_and_plot_top_positions
Prints and/or plots the exposures of the top 10 held positions of all time. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. positions_alloc : pd.DataFrame Portfolio allocation of...
pyfolio/plotting.py
def show_and_plot_top_positions(returns, positions_alloc, show_and_plot=2, hide_positions=False, legend_loc='real_best', ax=None, **kwargs): """ Prints and/or plots the exposures of the top 10 held positions of a...
def show_and_plot_top_positions(returns, positions_alloc, show_and_plot=2, hide_positions=False, legend_loc='real_best', ax=None, **kwargs): """ Prints and/or plots the exposures of the top 10 held positions of a...
[ "Prints", "and", "/", "or", "plots", "the", "exposures", "of", "the", "top", "10", "held", "positions", "of", "all", "time", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1114-L1194
[ "def", "show_and_plot_top_positions", "(", "returns", ",", "positions_alloc", ",", "show_and_plot", "=", "2", ",", "hide_positions", "=", "False", ",", "legend_loc", "=", "'real_best'", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "positions_allo...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_max_median_position_concentration
Plots the max and median of long and short position concentrations over the time. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. ax : matplotlib.Axes, optional Axes upon which to plot. Returns ------- ax : matplotlib.Axes...
pyfolio/plotting.py
def plot_max_median_position_concentration(positions, ax=None, **kwargs): """ Plots the max and median of long and short position concentrations over the time. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. ax : matplotlib.Axes, optio...
def plot_max_median_position_concentration(positions, ax=None, **kwargs): """ Plots the max and median of long and short position concentrations over the time. Parameters ---------- positions : pd.DataFrame The positions that the strategy takes over time. ax : matplotlib.Axes, optio...
[ "Plots", "the", "max", "and", "median", "of", "long", "and", "short", "position", "concentrations", "over", "the", "time", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1197-L1226
[ "def", "plot_max_median_position_concentration", "(", "positions", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "alloc_summary", "=", "pos", ".", "get_max_median_position_...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_sector_allocations
Plots the sector exposures of the portfolio over time. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. sector_alloc : pd.DataFrame Portfolio allocation of positions. See pos.get_sect...
pyfolio/plotting.py
def plot_sector_allocations(returns, sector_alloc, ax=None, **kwargs): """ Plots the sector exposures of the portfolio over time. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. sect...
def plot_sector_allocations(returns, sector_alloc, ax=None, **kwargs): """ Plots the sector exposures of the portfolio over time. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. sect...
[ "Plots", "the", "sector", "exposures", "of", "the", "portfolio", "over", "time", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1229-L1269
[ "def", "plot_sector_allocations", "(", "returns", ",", "sector_alloc", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "sector_alloc", ".", "plot", "(", "title", "=", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_return_quantiles
Creates a box plot of daily, weekly, and monthly return distributions. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. live_start_date : datetime, optional The point in time when...
pyfolio/plotting.py
def plot_return_quantiles(returns, live_start_date=None, ax=None, **kwargs): """ Creates a box plot of daily, weekly, and monthly return distributions. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create...
def plot_return_quantiles(returns, live_start_date=None, ax=None, **kwargs): """ Creates a box plot of daily, weekly, and monthly return distributions. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create...
[ "Creates", "a", "box", "plot", "of", "daily", "weekly", "and", "monthly", "return", "distributions", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1272-L1322
[ "def", "plot_return_quantiles", "(", "returns", ",", "live_start_date", "=", "None", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "is_returns", "=", "returns", "if",...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_turnover
Plots turnover vs. date. Turnover is the number of shares traded for a period as a fraction of total shares. Displays daily total, daily average per month, and all-time daily average. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. ...
pyfolio/plotting.py
def plot_turnover(returns, transactions, positions, legend_loc='best', ax=None, **kwargs): """ Plots turnover vs. date. Turnover is the number of shares traded for a period as a fraction of total shares. Displays daily total, daily average per month, and all-time daily averag...
def plot_turnover(returns, transactions, positions, legend_loc='best', ax=None, **kwargs): """ Plots turnover vs. date. Turnover is the number of shares traded for a period as a fraction of total shares. Displays daily total, daily average per month, and all-time daily averag...
[ "Plots", "turnover", "vs", ".", "date", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1325-L1386
[ "def", "plot_turnover", "(", "returns", ",", "transactions", ",", "positions", ",", "legend_loc", "=", "'best'", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "y_ax...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_slippage_sweep
Plots equity curves at different per-dollar slippage assumptions. Parameters ---------- returns : pd.Series Timeseries of portfolio returns to be adjusted for various degrees of slippage. positions : pd.DataFrame Daily net position values. - See full explanation in tear...
pyfolio/plotting.py
def plot_slippage_sweep(returns, positions, transactions, slippage_params=(3, 8, 10, 12, 15, 20, 50), ax=None, **kwargs): """ Plots equity curves at different per-dollar slippage assumptions. Parameters ---------- returns : pd.Series Timeserie...
def plot_slippage_sweep(returns, positions, transactions, slippage_params=(3, 8, 10, 12, 15, 20, 50), ax=None, **kwargs): """ Plots equity curves at different per-dollar slippage assumptions. Parameters ---------- returns : pd.Series Timeserie...
[ "Plots", "equity", "curves", "at", "different", "per", "-", "dollar", "slippage", "assumptions", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1389-L1437
[ "def", "plot_slippage_sweep", "(", "returns", ",", "positions", ",", "transactions", ",", "slippage_params", "=", "(", "3", ",", "8", ",", "10", ",", "12", ",", "15", ",", "20", ",", "50", ")", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_slippage_sensitivity
Plots curve relating per-dollar slippage to average annual returns. Parameters ---------- returns : pd.Series Timeseries of portfolio returns to be adjusted for various degrees of slippage. positions : pd.DataFrame Daily net position values. - See full explanation in te...
pyfolio/plotting.py
def plot_slippage_sensitivity(returns, positions, transactions, ax=None, **kwargs): """ Plots curve relating per-dollar slippage to average annual returns. Parameters ---------- returns : pd.Series Timeseries of portfolio returns to be adjusted for various ...
def plot_slippage_sensitivity(returns, positions, transactions, ax=None, **kwargs): """ Plots curve relating per-dollar slippage to average annual returns. Parameters ---------- returns : pd.Series Timeseries of portfolio returns to be adjusted for various ...
[ "Plots", "curve", "relating", "per", "-", "dollar", "slippage", "to", "average", "annual", "returns", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1440-L1484
[ "def", "plot_slippage_sensitivity", "(", "returns", ",", "positions", ",", "transactions", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "avg_returns_given_slippage", "="...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_daily_turnover_hist
Plots a histogram of daily turnover rates. Parameters ---------- transactions : pd.DataFrame Prices and amounts of executed trades. One row per trade. - See full explanation in tears.create_full_tear_sheet. positions : pd.DataFrame Daily net position values. - See full...
pyfolio/plotting.py
def plot_daily_turnover_hist(transactions, positions, ax=None, **kwargs): """ Plots a histogram of daily turnover rates. Parameters ---------- transactions : pd.DataFrame Prices and amounts of executed trades. One row per trade. - See full explanation i...
def plot_daily_turnover_hist(transactions, positions, ax=None, **kwargs): """ Plots a histogram of daily turnover rates. Parameters ---------- transactions : pd.DataFrame Prices and amounts of executed trades. One row per trade. - See full explanation i...
[ "Plots", "a", "histogram", "of", "daily", "turnover", "rates", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1519-L1549
[ "def", "plot_daily_turnover_hist", "(", "transactions", ",", "positions", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "turnover", "=", "txn", ".", "get_turnover", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_daily_volume
Plots trading volume per day vs. date. Also displays all-time daily average. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. transactions : pd.DataFrame Prices and amounts of ex...
pyfolio/plotting.py
def plot_daily_volume(returns, transactions, ax=None, **kwargs): """ Plots trading volume per day vs. date. Also displays all-time daily average. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full...
def plot_daily_volume(returns, transactions, ax=None, **kwargs): """ Plots trading volume per day vs. date. Also displays all-time daily average. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full...
[ "Plots", "trading", "volume", "per", "day", "vs", ".", "date", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1552-L1587
[ "def", "plot_daily_volume", "(", "returns", ",", "transactions", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", "daily_txn", "=", "txn", ".", "get_txn_vol", "(", "tr...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_txn_time_hist
Plots a histogram of transaction times, binning the times into buckets of a given duration. Parameters ---------- transactions : pd.DataFrame Prices and amounts of executed trades. One row per trade. - See full explanation in tears.create_full_tear_sheet. bin_minutes : float, optio...
pyfolio/plotting.py
def plot_txn_time_hist(transactions, bin_minutes=5, tz='America/New_York', ax=None, **kwargs): """ Plots a histogram of transaction times, binning the times into buckets of a given duration. Parameters ---------- transactions : pd.DataFrame Prices and amounts of e...
def plot_txn_time_hist(transactions, bin_minutes=5, tz='America/New_York', ax=None, **kwargs): """ Plots a histogram of transaction times, binning the times into buckets of a given duration. Parameters ---------- transactions : pd.DataFrame Prices and amounts of e...
[ "Plots", "a", "histogram", "of", "transaction", "times", "binning", "the", "times", "into", "buckets", "of", "a", "given", "duration", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1590-L1645
[ "def", "plot_txn_time_hist", "(", "transactions", ",", "bin_minutes", "=", "5", ",", "tz", "=", "'America/New_York'", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "gca", "(", ")", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
show_worst_drawdown_periods
Prints information about the worst drawdown periods. Prints peak dates, valley dates, recovery dates, and net drawdowns. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, o...
pyfolio/plotting.py
def show_worst_drawdown_periods(returns, top=5): """ Prints information about the worst drawdown periods. Prints peak dates, valley dates, recovery dates, and net drawdowns. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full ...
def show_worst_drawdown_periods(returns, top=5): """ Prints information about the worst drawdown periods. Prints peak dates, valley dates, recovery dates, and net drawdowns. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full ...
[ "Prints", "information", "about", "the", "worst", "drawdown", "periods", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1648-L1669
[ "def", "show_worst_drawdown_periods", "(", "returns", ",", "top", "=", "5", ")", ":", "drawdown_df", "=", "timeseries", ".", "gen_drawdown_table", "(", "returns", ",", "top", "=", "top", ")", "utils", ".", "print_table", "(", "drawdown_df", ".", "sort_values",...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_monthly_returns_timeseries
Plots monthly returns as a timeseries. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. ax : matplotlib.Axes, optional Axes upon which to plot. **kwargs, optional Passed t...
pyfolio/plotting.py
def plot_monthly_returns_timeseries(returns, ax=None, **kwargs): """ Plots monthly returns as a timeseries. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. ax : matplotlib.Axes, opti...
def plot_monthly_returns_timeseries(returns, ax=None, **kwargs): """ Plots monthly returns as a timeseries. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. ax : matplotlib.Axes, opti...
[ "Plots", "monthly", "returns", "as", "a", "timeseries", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1672-L1725
[ "def", "plot_monthly_returns_timeseries", "(", "returns", ",", "ax", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "cumulate_returns", "(", "x", ")", ":", "return", "ep", ".", "cum_returns", "(", "x", ")", "[", "-", "1", "]", "if", "ax", "is...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_round_trip_lifetimes
Plots timespans and directions of a sample of round trip trades. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_trips ax : matplotlib.Axes, optional Axes upon which to plot. R...
pyfolio/plotting.py
def plot_round_trip_lifetimes(round_trips, disp_amount=16, lsize=18, ax=None): """ Plots timespans and directions of a sample of round trip trades. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.ext...
def plot_round_trip_lifetimes(round_trips, disp_amount=16, lsize=18, ax=None): """ Plots timespans and directions of a sample of round trip trades. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.ext...
[ "Plots", "timespans", "and", "directions", "of", "a", "sample", "of", "round", "trip", "trades", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1728-L1776
[ "def", "plot_round_trip_lifetimes", "(", "round_trips", ",", "disp_amount", "=", "16", ",", "lsize", "=", "18", ",", "ax", "=", "None", ")", ":", "if", "ax", "is", "None", ":", "ax", "=", "plt", ".", "subplot", "(", ")", "symbols_sample", "=", "round_t...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
show_profit_attribution
Prints the share of total PnL contributed by each traded name. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_trips ax : matplotlib.Axes, optional Axes upon which to plot. ...
pyfolio/plotting.py
def show_profit_attribution(round_trips): """ Prints the share of total PnL contributed by each traded name. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_trips ax : matplotli...
def show_profit_attribution(round_trips): """ Prints the share of total PnL contributed by each traded name. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_trips ax : matplotli...
[ "Prints", "the", "share", "of", "total", "PnL", "contributed", "by", "each", "traded", "name", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1779-L1810
[ "def", "show_profit_attribution", "(", "round_trips", ")", ":", "total_pnl", "=", "round_trips", "[", "'pnl'", "]", ".", "sum", "(", ")", "pnl_attribution", "=", "round_trips", ".", "groupby", "(", "'symbol'", ")", "[", "'pnl'", "]", ".", "sum", "(", ")", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_prob_profit_trade
Plots a probability distribution for the event of making a profitable trade. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_trips ax : matplotlib.Axes, optional Axes upon which...
pyfolio/plotting.py
def plot_prob_profit_trade(round_trips, ax=None): """ Plots a probability distribution for the event of making a profitable trade. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_tr...
def plot_prob_profit_trade(round_trips, ax=None): """ Plots a probability distribution for the event of making a profitable trade. Parameters ---------- round_trips : pd.DataFrame DataFrame with one row per round trip trade. - See full explanation in round_trips.extract_round_tr...
[ "Plots", "a", "probability", "distribution", "for", "the", "event", "of", "making", "a", "profitable", "trade", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1813-L1857
[ "def", "plot_prob_profit_trade", "(", "round_trips", ",", "ax", "=", "None", ")", ":", "x", "=", "np", ".", "linspace", "(", "0", ",", "1.", ",", "500", ")", "round_trips", "[", "'profitable'", "]", "=", "round_trips", ".", "pnl", ">", "0", "dist", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_cones
Plots the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Redraws a new cone when cumulative returns fall outside of last cone drawn. Parameters ---------- name : str Account name to be used as figure title. bounds : pandas.core.frame.DataFrame ...
pyfolio/plotting.py
def plot_cones(name, bounds, oos_returns, num_samples=1000, ax=None, cone_std=(1., 1.5, 2.), random_seed=None, num_strikes=3): """ Plots the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Redraws a new cone when cumulative returns fall outside of ...
def plot_cones(name, bounds, oos_returns, num_samples=1000, ax=None, cone_std=(1., 1.5, 2.), random_seed=None, num_strikes=3): """ Plots the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Redraws a new cone when cumulative returns fall outside of ...
[ "Plots", "the", "upper", "and", "lower", "bounds", "of", "an", "n", "standard", "deviation", "cone", "of", "forecasted", "cumulative", "returns", ".", "Redraws", "a", "new", "cone", "when", "cumulative", "returns", "fall", "outside", "of", "last", "cone", "d...
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/plotting.py#L1860-L1953
[ "def", "plot_cones", "(", "name", ",", "bounds", ",", "oos_returns", ",", "num_samples", "=", "1000", ",", "ax", "=", "None", ",", "cone_std", "=", "(", "1.", ",", "1.5", ",", "2.", ")", ",", "random_seed", "=", "None", ",", "num_strikes", "=", "3", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
var_cov_var_normal
Variance-covariance calculation of daily Value-at-Risk in a portfolio. Parameters ---------- P : float Portfolio value. c : float Confidence level. mu : float, optional Mean. Returns ------- float Variance-covariance.
pyfolio/timeseries.py
def var_cov_var_normal(P, c, mu=0, sigma=1): """ Variance-covariance calculation of daily Value-at-Risk in a portfolio. Parameters ---------- P : float Portfolio value. c : float Confidence level. mu : float, optional Mean. Returns ------- float ...
def var_cov_var_normal(P, c, mu=0, sigma=1): """ Variance-covariance calculation of daily Value-at-Risk in a portfolio. Parameters ---------- P : float Portfolio value. c : float Confidence level. mu : float, optional Mean. Returns ------- float ...
[ "Variance", "-", "covariance", "calculation", "of", "daily", "Value", "-", "at", "-", "Risk", "in", "a", "portfolio", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L38-L59
[ "def", "var_cov_var_normal", "(", "P", ",", "c", ",", "mu", "=", "0", ",", "sigma", "=", "1", ")", ":", "alpha", "=", "sp", ".", "stats", ".", "norm", ".", "ppf", "(", "1", "-", "c", ",", "mu", ",", "sigma", ")", "return", "P", "-", "P", "*...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
sortino_ratio
Determines the Sortino ratio of a strategy. Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. required_return: float / series minimum acceptable return pe...
pyfolio/timeseries.py
def sortino_ratio(returns, required_return=0, period=DAILY): """ Determines the Sortino ratio of a strategy. Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. ...
def sortino_ratio(returns, required_return=0, period=DAILY): """ Determines the Sortino ratio of a strategy. Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. ...
[ "Determines", "the", "Sortino", "ratio", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L202-L227
[ "def", "sortino_ratio", "(", "returns", ",", "required_return", "=", "0", ",", "period", "=", "DAILY", ")", ":", "return", "ep", ".", "sortino_ratio", "(", "returns", ",", "required_return", "=", "required_return", ")" ]
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
downside_risk
Determines the downside deviation below a threshold Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. required_return: float / series minimum acceptable retur...
pyfolio/timeseries.py
def downside_risk(returns, required_return=0, period=DAILY): """ Determines the downside deviation below a threshold Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_retur...
def downside_risk(returns, required_return=0, period=DAILY): """ Determines the downside deviation below a threshold Parameters ---------- returns : pd.Series or pd.DataFrame Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_retur...
[ "Determines", "the", "downside", "deviation", "below", "a", "threshold" ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L231-L258
[ "def", "downside_risk", "(", "returns", ",", "required_return", "=", "0", ",", "period", "=", "DAILY", ")", ":", "return", "ep", ".", "downside_risk", "(", "returns", ",", "required_return", "=", "required_return", ",", "period", "=", "period", ")" ]
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
sharpe_ratio
Determines the Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. risk_free : int, float Constant risk-free return throughout the period. perio...
pyfolio/timeseries.py
def sharpe_ratio(returns, risk_free=0, period=DAILY): """ Determines the Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. risk_free : int, float ...
def sharpe_ratio(returns, risk_free=0, period=DAILY): """ Determines the Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. risk_free : int, float ...
[ "Determines", "the", "Sharpe", "ratio", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L262-L290
[ "def", "sharpe_ratio", "(", "returns", ",", "risk_free", "=", "0", ",", "period", "=", "DAILY", ")", ":", "return", "ep", ".", "sharpe_ratio", "(", "returns", ",", "risk_free", "=", "risk_free", ",", "period", "=", "period", ")" ]
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
rolling_beta
Determines the rolling beta of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. factor_returns : pd.Series or pd.DataFrame Daily noncumulative returns of the benchmark fac...
pyfolio/timeseries.py
def rolling_beta(returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6): """ Determines the rolling beta of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_...
def rolling_beta(returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6): """ Determines the rolling beta of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_...
[ "Determines", "the", "rolling", "beta", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L507-L548
[ "def", "rolling_beta", "(", "returns", ",", "factor_returns", ",", "rolling_window", "=", "APPROX_BDAYS_PER_MONTH", "*", "6", ")", ":", "if", "factor_returns", ".", "ndim", ">", "1", ":", "# Apply column-wise", "return", "factor_returns", ".", "apply", "(", "par...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
rolling_regression
Computes rolling factor betas using a multivariate linear regression (separate linear regressions is problematic because the factors may be confounded). Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_fu...
pyfolio/timeseries.py
def rolling_regression(returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6, nan_threshold=0.1): """ Computes rolling factor betas using a multivariate linear regression (separate linear regressions is problematic because the factors may be con...
def rolling_regression(returns, factor_returns, rolling_window=APPROX_BDAYS_PER_MONTH * 6, nan_threshold=0.1): """ Computes rolling factor betas using a multivariate linear regression (separate linear regressions is problematic because the factors may be con...
[ "Computes", "rolling", "factor", "betas", "using", "a", "multivariate", "linear", "regression", "(", "separate", "linear", "regressions", "is", "problematic", "because", "the", "factors", "may", "be", "confounded", ")", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L551-L603
[ "def", "rolling_regression", "(", "returns", ",", "factor_returns", ",", "rolling_window", "=", "APPROX_BDAYS_PER_MONTH", "*", "6", ",", "nan_threshold", "=", "0.1", ")", ":", "# We need to drop NaNs to regress", "ret_no_na", "=", "returns", ".", "dropna", "(", ")",...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
gross_lev
Calculates the gross leverage of a strategy. Parameters ---------- positions : pd.DataFrame Daily net position values. - See full explanation in tears.create_full_tear_sheet. Returns ------- pd.Series Gross leverage.
pyfolio/timeseries.py
def gross_lev(positions): """ Calculates the gross leverage of a strategy. Parameters ---------- positions : pd.DataFrame Daily net position values. - See full explanation in tears.create_full_tear_sheet. Returns ------- pd.Series Gross leverage. """ e...
def gross_lev(positions): """ Calculates the gross leverage of a strategy. Parameters ---------- positions : pd.DataFrame Daily net position values. - See full explanation in tears.create_full_tear_sheet. Returns ------- pd.Series Gross leverage. """ e...
[ "Calculates", "the", "gross", "leverage", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L606-L623
[ "def", "gross_lev", "(", "positions", ")", ":", "exposure", "=", "positions", ".", "drop", "(", "'cash'", ",", "axis", "=", "1", ")", ".", "abs", "(", ")", ".", "sum", "(", "axis", "=", "1", ")", "return", "exposure", "/", "positions", ".", "sum", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
value_at_risk
Get value at risk (VaR). Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. period : str, optional Period over which to calculate VaR. Set to 'weekly', 'monthly', or 'yearly', o...
pyfolio/timeseries.py
def value_at_risk(returns, period=None, sigma=2.0): """ Get value at risk (VaR). Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. period : str, optional Period over which to c...
def value_at_risk(returns, period=None, sigma=2.0): """ Get value at risk (VaR). Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. period : str, optional Period over which to c...
[ "Get", "value", "at", "risk", "(", "VaR", ")", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L626-L648
[ "def", "value_at_risk", "(", "returns", ",", "period", "=", "None", ",", "sigma", "=", "2.0", ")", ":", "if", "period", "is", "not", "None", ":", "returns_agg", "=", "ep", ".", "aggregate_returns", "(", "returns", ",", "period", ")", "else", ":", "retu...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
perf_stats
Calculates various performance metrics of a strategy, for use in plotting.show_perf_stats. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. factor_returns : pd.Series, optional Da...
pyfolio/timeseries.py
def perf_stats(returns, factor_returns=None, positions=None, transactions=None, turnover_denom='AGB'): """ Calculates various performance metrics of a strategy, for use in plotting.show_perf_stats. Parameters ---------- returns : pd.Series Daily returns of the strategy, n...
def perf_stats(returns, factor_returns=None, positions=None, transactions=None, turnover_denom='AGB'): """ Calculates various performance metrics of a strategy, for use in plotting.show_perf_stats. Parameters ---------- returns : pd.Series Daily returns of the strategy, n...
[ "Calculates", "various", "performance", "metrics", "of", "a", "strategy", "for", "use", "in", "plotting", ".", "show_perf_stats", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L692-L739
[ "def", "perf_stats", "(", "returns", ",", "factor_returns", "=", "None", ",", "positions", "=", "None", ",", "transactions", "=", "None", ",", "turnover_denom", "=", "'AGB'", ")", ":", "stats", "=", "pd", ".", "Series", "(", ")", "for", "stat_func", "in"...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
perf_stats_bootstrap
Calculates various bootstrapped performance metrics of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. factor_returns : pd.Series, optional Daily noncumulative returns of...
pyfolio/timeseries.py
def perf_stats_bootstrap(returns, factor_returns=None, return_stats=True, **kwargs): """Calculates various bootstrapped performance metrics of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explana...
def perf_stats_bootstrap(returns, factor_returns=None, return_stats=True, **kwargs): """Calculates various bootstrapped performance metrics of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explana...
[ "Calculates", "various", "bootstrapped", "performance", "metrics", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L742-L793
[ "def", "perf_stats_bootstrap", "(", "returns", ",", "factor_returns", "=", "None", ",", "return_stats", "=", "True", ",", "*", "*", "kwargs", ")", ":", "bootstrap_values", "=", "OrderedDict", "(", ")", "for", "stat_func", "in", "SIMPLE_STAT_FUNCS", ":", "stat_...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
calc_bootstrap
Performs a bootstrap analysis on a user-defined function returning a summary statistic. Parameters ---------- func : function Function that either takes a single array (commonly returns) or two arrays (commonly returns and factor returns) and returns a single value (commonly a s...
pyfolio/timeseries.py
def calc_bootstrap(func, returns, *args, **kwargs): """Performs a bootstrap analysis on a user-defined function returning a summary statistic. Parameters ---------- func : function Function that either takes a single array (commonly returns) or two arrays (commonly returns and facto...
def calc_bootstrap(func, returns, *args, **kwargs): """Performs a bootstrap analysis on a user-defined function returning a summary statistic. Parameters ---------- func : function Function that either takes a single array (commonly returns) or two arrays (commonly returns and facto...
[ "Performs", "a", "bootstrap", "analysis", "on", "a", "user", "-", "defined", "function", "returning", "a", "summary", "statistic", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L796-L840
[ "def", "calc_bootstrap", "(", "func", ",", "returns", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "n_samples", "=", "kwargs", ".", "pop", "(", "'n_samples'", ",", "1000", ")", "out", "=", "np", ".", "empty", "(", "n_samples", ")", "factor_re...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
calc_distribution_stats
Calculate various summary statistics of data. Parameters ---------- x : numpy.ndarray or pandas.Series Array to compute summary statistics for. Returns ------- pandas.Series Series containing mean, median, std, as well as 5, 25, 75 and 95 percentiles of passed in values...
pyfolio/timeseries.py
def calc_distribution_stats(x): """Calculate various summary statistics of data. Parameters ---------- x : numpy.ndarray or pandas.Series Array to compute summary statistics for. Returns ------- pandas.Series Series containing mean, median, std, as well as 5, 25, 75 and ...
def calc_distribution_stats(x): """Calculate various summary statistics of data. Parameters ---------- x : numpy.ndarray or pandas.Series Array to compute summary statistics for. Returns ------- pandas.Series Series containing mean, median, std, as well as 5, 25, 75 and ...
[ "Calculate", "various", "summary", "statistics", "of", "data", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L843-L867
[ "def", "calc_distribution_stats", "(", "x", ")", ":", "return", "pd", ".", "Series", "(", "{", "'mean'", ":", "np", ".", "mean", "(", "x", ")", ",", "'median'", ":", "np", ".", "median", "(", "x", ")", ",", "'std'", ":", "np", ".", "std", "(", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
get_max_drawdown_underwater
Determines peak, valley, and recovery dates given an 'underwater' DataFrame. An underwater DataFrame is a DataFrame that has precomputed rolling drawdown. Parameters ---------- underwater : pd.Series Underwater returns (rolling drawdown) of a strategy. Returns ------- peak ...
pyfolio/timeseries.py
def get_max_drawdown_underwater(underwater): """ Determines peak, valley, and recovery dates given an 'underwater' DataFrame. An underwater DataFrame is a DataFrame that has precomputed rolling drawdown. Parameters ---------- underwater : pd.Series Underwater returns (rolling dr...
def get_max_drawdown_underwater(underwater): """ Determines peak, valley, and recovery dates given an 'underwater' DataFrame. An underwater DataFrame is a DataFrame that has precomputed rolling drawdown. Parameters ---------- underwater : pd.Series Underwater returns (rolling dr...
[ "Determines", "peak", "valley", "and", "recovery", "dates", "given", "an", "underwater", "DataFrame", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L870-L901
[ "def", "get_max_drawdown_underwater", "(", "underwater", ")", ":", "valley", "=", "np", ".", "argmin", "(", "underwater", ")", "# end of the period", "# Find first 0", "peak", "=", "underwater", "[", ":", "valley", "]", "[", "underwater", "[", ":", "valley", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
get_max_drawdown
Determines the maximum drawdown of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. Returns ------- float Maximum drawdown. Note ----- See ...
pyfolio/timeseries.py
def get_max_drawdown(returns): """ Determines the maximum drawdown of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. Returns ------- float Max...
def get_max_drawdown(returns): """ Determines the maximum drawdown of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in :func:`~pyfolio.timeseries.cum_returns`. Returns ------- float Max...
[ "Determines", "the", "maximum", "drawdown", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L904-L928
[ "def", "get_max_drawdown", "(", "returns", ")", ":", "returns", "=", "returns", ".", "copy", "(", ")", "df_cum", "=", "cum_returns", "(", "returns", ",", "1.0", ")", "running_max", "=", "np", ".", "maximum", ".", "accumulate", "(", "df_cum", ")", "underw...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
get_top_drawdowns
Finds top drawdowns, sorted by drawdown amount. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of top drawdowns to find (default 10). Returns ...
pyfolio/timeseries.py
def get_top_drawdowns(returns, top=10): """ Finds top drawdowns, sorted by drawdown amount. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of ...
def get_top_drawdowns(returns, top=10): """ Finds top drawdowns, sorted by drawdown amount. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of ...
[ "Finds", "top", "drawdowns", "sorted", "by", "drawdown", "amount", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L931-L969
[ "def", "get_top_drawdowns", "(", "returns", ",", "top", "=", "10", ")", ":", "returns", "=", "returns", ".", "copy", "(", ")", "df_cum", "=", "ep", ".", "cum_returns", "(", "returns", ",", "1.0", ")", "running_max", "=", "np", ".", "maximum", ".", "a...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
gen_drawdown_table
Places top drawdowns in a table. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of top drawdowns to find (default 10). Returns ------- df...
pyfolio/timeseries.py
def gen_drawdown_table(returns, top=10): """ Places top drawdowns in a table. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of top drawdowns ...
def gen_drawdown_table(returns, top=10): """ Places top drawdowns in a table. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. top : int, optional The amount of top drawdowns ...
[ "Places", "top", "drawdowns", "in", "a", "table", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L972-L1023
[ "def", "gen_drawdown_table", "(", "returns", ",", "top", "=", "10", ")", ":", "df_cum", "=", "ep", ".", "cum_returns", "(", "returns", ",", "1.0", ")", "drawdown_periods", "=", "get_top_drawdowns", "(", "returns", ",", "top", "=", "top", ")", "df_drawdowns...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
rolling_volatility
Determines the rolling volatility of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_vol_window : int Length of rolling window, in days, over which to compute. ...
pyfolio/timeseries.py
def rolling_volatility(returns, rolling_vol_window): """ Determines the rolling volatility of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_vol_window : int ...
def rolling_volatility(returns, rolling_vol_window): """ Determines the rolling volatility of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_vol_window : int ...
[ "Determines", "the", "rolling", "volatility", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1026-L1045
[ "def", "rolling_volatility", "(", "returns", ",", "rolling_vol_window", ")", ":", "return", "returns", ".", "rolling", "(", "rolling_vol_window", ")", ".", "std", "(", ")", "*", "np", ".", "sqrt", "(", "APPROX_BDAYS_PER_YEAR", ")" ]
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
rolling_sharpe
Determines the rolling Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_sharpe_window : int Length of rolling window, in days, over which to comput...
pyfolio/timeseries.py
def rolling_sharpe(returns, rolling_sharpe_window): """ Determines the rolling Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_sharpe_window : int...
def rolling_sharpe(returns, rolling_sharpe_window): """ Determines the rolling Sharpe ratio of a strategy. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. rolling_sharpe_window : int...
[ "Determines", "the", "rolling", "Sharpe", "ratio", "of", "a", "strategy", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1048-L1072
[ "def", "rolling_sharpe", "(", "returns", ",", "rolling_sharpe_window", ")", ":", "return", "returns", ".", "rolling", "(", "rolling_sharpe_window", ")", ".", "mean", "(", ")", "/", "returns", ".", "rolling", "(", "rolling_sharpe_window", ")", ".", "std", "(", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
simulate_paths
Gnerate alternate paths using available values from in-sample returns. Parameters ---------- is_returns : pandas.core.frame.DataFrame Non-cumulative in-sample returns. num_days : int Number of days to project the probability cone forward. starting_value : int or float Starti...
pyfolio/timeseries.py
def simulate_paths(is_returns, num_days, starting_value=1, num_samples=1000, random_seed=None): """ Gnerate alternate paths using available values from in-sample returns. Parameters ---------- is_returns : pandas.core.frame.DataFrame Non-cumulative in-sample returns. ...
def simulate_paths(is_returns, num_days, starting_value=1, num_samples=1000, random_seed=None): """ Gnerate alternate paths using available values from in-sample returns. Parameters ---------- is_returns : pandas.core.frame.DataFrame Non-cumulative in-sample returns. ...
[ "Gnerate", "alternate", "paths", "using", "available", "values", "from", "in", "-", "sample", "returns", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1075-L1108
[ "def", "simulate_paths", "(", "is_returns", ",", "num_days", ",", "starting_value", "=", "1", ",", "num_samples", "=", "1000", ",", "random_seed", "=", "None", ")", ":", "samples", "=", "np", ".", "empty", "(", "(", "num_samples", ",", "num_days", ")", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
summarize_paths
Gnerate the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Parameters ---------- samples : numpy.ndarray Alternative paths, or series of possible outcomes. cone_std : list of int/float Number of standard devations to use in the boundaries of...
pyfolio/timeseries.py
def summarize_paths(samples, cone_std=(1., 1.5, 2.), starting_value=1.): """ Gnerate the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Parameters ---------- samples : numpy.ndarray Alternative paths, or series of possible outcomes. cone_std...
def summarize_paths(samples, cone_std=(1., 1.5, 2.), starting_value=1.): """ Gnerate the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Parameters ---------- samples : numpy.ndarray Alternative paths, or series of possible outcomes. cone_std...
[ "Gnerate", "the", "upper", "and", "lower", "bounds", "of", "an", "n", "standard", "deviation", "cone", "of", "forecasted", "cumulative", "returns", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1111-L1144
[ "def", "summarize_paths", "(", "samples", ",", "cone_std", "=", "(", "1.", ",", "1.5", ",", "2.", ")", ",", "starting_value", "=", "1.", ")", ":", "cum_samples", "=", "ep", ".", "cum_returns", "(", "samples", ".", "T", ",", "starting_value", "=", "star...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
forecast_cone_bootstrap
Determines the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Future cumulative mean and standard devation are computed by repeatedly sampling from the in-sample daily returns (i.e. bootstrap). This cone is non-parametric, meaning it does not assume that returns...
pyfolio/timeseries.py
def forecast_cone_bootstrap(is_returns, num_days, cone_std=(1., 1.5, 2.), starting_value=1, num_samples=1000, random_seed=None): """ Determines the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Future cumulati...
def forecast_cone_bootstrap(is_returns, num_days, cone_std=(1., 1.5, 2.), starting_value=1, num_samples=1000, random_seed=None): """ Determines the upper and lower bounds of an n standard deviation cone of forecasted cumulative returns. Future cumulati...
[ "Determines", "the", "upper", "and", "lower", "bounds", "of", "an", "n", "standard", "deviation", "cone", "of", "forecasted", "cumulative", "returns", ".", "Future", "cumulative", "mean", "and", "standard", "devation", "are", "computed", "by", "repeatedly", "sam...
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1147-L1202
[ "def", "forecast_cone_bootstrap", "(", "is_returns", ",", "num_days", ",", "cone_std", "=", "(", "1.", ",", "1.5", ",", "2.", ")", ",", "starting_value", "=", "1", ",", "num_samples", "=", "1000", ",", "random_seed", "=", "None", ")", ":", "samples", "="...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
extract_interesting_date_ranges
Extracts returns based on interesting events. See gen_date_range_interesting. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. Returns ------- ranges : OrderedDict Date r...
pyfolio/timeseries.py
def extract_interesting_date_ranges(returns): """ Extracts returns based on interesting events. See gen_date_range_interesting. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. R...
def extract_interesting_date_ranges(returns): """ Extracts returns based on interesting events. See gen_date_range_interesting. Parameters ---------- returns : pd.Series Daily returns of the strategy, noncumulative. - See full explanation in tears.create_full_tear_sheet. R...
[ "Extracts", "returns", "based", "on", "interesting", "events", ".", "See", "gen_date_range_interesting", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/timeseries.py#L1205-L1234
[ "def", "extract_interesting_date_ranges", "(", "returns", ")", ":", "returns_dupe", "=", "returns", ".", "copy", "(", ")", "returns_dupe", ".", "index", "=", "returns_dupe", ".", "index", ".", "map", "(", "pd", ".", "Timestamp", ")", "ranges", "=", "OrderedD...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
model_returns_t_alpha_beta
Run Bayesian alpha-beta-model with T distributed returns. This model estimates intercept (alpha) and slope (beta) of two return sets. Usually, these will be algorithm returns and benchmark returns (e.g. S&P500). The data is assumed to be T distributed and thus is robust to outliers and takes tail event...
pyfolio/bayesian.py
def model_returns_t_alpha_beta(data, bmark, samples=2000, progressbar=True): """ Run Bayesian alpha-beta-model with T distributed returns. This model estimates intercept (alpha) and slope (beta) of two return sets. Usually, these will be algorithm returns and benchmark returns (e.g. S&P500). The da...
def model_returns_t_alpha_beta(data, bmark, samples=2000, progressbar=True): """ Run Bayesian alpha-beta-model with T distributed returns. This model estimates intercept (alpha) and slope (beta) of two return sets. Usually, these will be algorithm returns and benchmark returns (e.g. S&P500). The da...
[ "Run", "Bayesian", "alpha", "-", "beta", "-", "model", "with", "T", "distributed", "returns", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L30-L86
[ "def", "model_returns_t_alpha_beta", "(", "data", ",", "bmark", ",", "samples", "=", "2000", ",", "progressbar", "=", "True", ")", ":", "data_bmark", "=", "pd", ".", "concat", "(", "[", "data", ",", "bmark", "]", ",", "axis", "=", "1", ")", ".", "dro...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
model_returns_normal
Run Bayesian model assuming returns are normally distributed. Parameters ---------- returns : pandas.Series Series of simple returns of an algorithm or stock. samples : int (optional) Number of posterior samples to draw. Returns ------- model : pymc.Model object PyM...
pyfolio/bayesian.py
def model_returns_normal(data, samples=500, progressbar=True): """ Run Bayesian model assuming returns are normally distributed. Parameters ---------- returns : pandas.Series Series of simple returns of an algorithm or stock. samples : int (optional) Number of posterior samples ...
def model_returns_normal(data, samples=500, progressbar=True): """ Run Bayesian model assuming returns are normally distributed. Parameters ---------- returns : pandas.Series Series of simple returns of an algorithm or stock. samples : int (optional) Number of posterior samples ...
[ "Run", "Bayesian", "model", "assuming", "returns", "are", "normally", "distributed", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L89-L124
[ "def", "model_returns_normal", "(", "data", ",", "samples", "=", "500", ",", "progressbar", "=", "True", ")", ":", "with", "pm", ".", "Model", "(", ")", "as", "model", ":", "mu", "=", "pm", ".", "Normal", "(", "'mean returns'", ",", "mu", "=", "0", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
model_best
Bayesian Estimation Supersedes the T-Test This model runs a Bayesian hypothesis comparing if y1 and y2 come from the same distribution. Returns are assumed to be T-distributed. In addition, computes annual volatility and Sharpe of in and out-of-sample periods. This model replicates the example us...
pyfolio/bayesian.py
def model_best(y1, y2, samples=1000, progressbar=True): """ Bayesian Estimation Supersedes the T-Test This model runs a Bayesian hypothesis comparing if y1 and y2 come from the same distribution. Returns are assumed to be T-distributed. In addition, computes annual volatility and Sharpe of in and ...
def model_best(y1, y2, samples=1000, progressbar=True): """ Bayesian Estimation Supersedes the T-Test This model runs a Bayesian hypothesis comparing if y1 and y2 come from the same distribution. Returns are assumed to be T-distributed. In addition, computes annual volatility and Sharpe of in and ...
[ "Bayesian", "Estimation", "Supersedes", "the", "T", "-", "Test" ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L169-L251
[ "def", "model_best", "(", "y1", ",", "y2", ",", "samples", "=", "1000", ",", "progressbar", "=", "True", ")", ":", "y", "=", "np", ".", "concatenate", "(", "(", "y1", ",", "y2", ")", ")", "mu_m", "=", "np", ".", "mean", "(", "y", ")", "mu_p", ...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_best
Plot BEST significance analysis. Parameters ---------- trace : pymc3.sampling.BaseTrace, optional trace object as returned by model_best() If not passed, will run model_best(), for which data_train and data_test are required. data_train : pandas.Series, optional Returns ...
pyfolio/bayesian.py
def plot_best(trace=None, data_train=None, data_test=None, samples=1000, burn=200, axs=None): """ Plot BEST significance analysis. Parameters ---------- trace : pymc3.sampling.BaseTrace, optional trace object as returned by model_best() If not passed, will run model_be...
def plot_best(trace=None, data_train=None, data_test=None, samples=1000, burn=200, axs=None): """ Plot BEST significance analysis. Parameters ---------- trace : pymc3.sampling.BaseTrace, optional trace object as returned by model_best() If not passed, will run model_be...
[ "Plot", "BEST", "significance", "analysis", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L254-L342
[ "def", "plot_best", "(", "trace", "=", "None", ",", "data_train", "=", "None", ",", "data_test", "=", "None", ",", "samples", "=", "1000", ",", "burn", "=", "200", ",", "axs", "=", "None", ")", ":", "if", "trace", "is", "None", ":", "if", "(", "d...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
model_stoch_vol
Run stochastic volatility model. This model estimates the volatility of a returns series over time. Returns are assumed to be T-distributed. lambda (width of T-distributed) is assumed to follow a random-walk. Parameters ---------- data : pandas.Series Return series to model. sample...
pyfolio/bayesian.py
def model_stoch_vol(data, samples=2000, progressbar=True): """ Run stochastic volatility model. This model estimates the volatility of a returns series over time. Returns are assumed to be T-distributed. lambda (width of T-distributed) is assumed to follow a random-walk. Parameters -------...
def model_stoch_vol(data, samples=2000, progressbar=True): """ Run stochastic volatility model. This model estimates the volatility of a returns series over time. Returns are assumed to be T-distributed. lambda (width of T-distributed) is assumed to follow a random-walk. Parameters -------...
[ "Run", "stochastic", "volatility", "model", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L345-L385
[ "def", "model_stoch_vol", "(", "data", ",", "samples", "=", "2000", ",", "progressbar", "=", "True", ")", ":", "from", "pymc3", ".", "distributions", ".", "timeseries", "import", "GaussianRandomWalk", "with", "pm", ".", "Model", "(", ")", "as", "model", ":...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_stoch_vol
Generate plot for stochastic volatility model. Parameters ---------- data : pandas.Series Returns to model. trace : pymc3.sampling.BaseTrace object, optional trace as returned by model_stoch_vol If not passed, sample from model. ax : matplotlib.axes object, optional ...
pyfolio/bayesian.py
def plot_stoch_vol(data, trace=None, ax=None): """ Generate plot for stochastic volatility model. Parameters ---------- data : pandas.Series Returns to model. trace : pymc3.sampling.BaseTrace object, optional trace as returned by model_stoch_vol If not passed, sample fro...
def plot_stoch_vol(data, trace=None, ax=None): """ Generate plot for stochastic volatility model. Parameters ---------- data : pandas.Series Returns to model. trace : pymc3.sampling.BaseTrace object, optional trace as returned by model_stoch_vol If not passed, sample fro...
[ "Generate", "plot", "for", "stochastic", "volatility", "model", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L388-L423
[ "def", "plot_stoch_vol", "(", "data", ",", "trace", "=", "None", ",", "ax", "=", "None", ")", ":", "if", "trace", "is", "None", ":", "trace", "=", "model_stoch_vol", "(", "data", ")", "if", "ax", "is", "None", ":", "fig", ",", "ax", "=", "plt", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
compute_bayes_cone
Compute 5, 25, 75 and 95 percentiles of cumulative returns, used for the Bayesian cone. Parameters ---------- preds : numpy.array Multiple (simulated) cumulative returns. starting_value : int (optional) Have cumulative returns start around this value. Default = 1. Retur...
pyfolio/bayesian.py
def compute_bayes_cone(preds, starting_value=1.): """ Compute 5, 25, 75 and 95 percentiles of cumulative returns, used for the Bayesian cone. Parameters ---------- preds : numpy.array Multiple (simulated) cumulative returns. starting_value : int (optional) Have cumulative re...
def compute_bayes_cone(preds, starting_value=1.): """ Compute 5, 25, 75 and 95 percentiles of cumulative returns, used for the Bayesian cone. Parameters ---------- preds : numpy.array Multiple (simulated) cumulative returns. starting_value : int (optional) Have cumulative re...
[ "Compute", "5", "25", "75", "and", "95", "percentiles", "of", "cumulative", "returns", "used", "for", "the", "Bayesian", "cone", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L426-L453
[ "def", "compute_bayes_cone", "(", "preds", ",", "starting_value", "=", "1.", ")", ":", "def", "scoreatpercentile", "(", "cum_preds", ",", "p", ")", ":", "return", "[", "stats", ".", "scoreatpercentile", "(", "c", ",", "p", ")", "for", "c", "in", "cum_pre...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
compute_consistency_score
Compute Bayesian consistency score. Parameters ---------- returns_test : pd.Series Observed cumulative returns. preds : numpy.array Multiple (simulated) cumulative returns. Returns ------- Consistency score Score from 100 (returns_test perfectly on the median line o...
pyfolio/bayesian.py
def compute_consistency_score(returns_test, preds): """ Compute Bayesian consistency score. Parameters ---------- returns_test : pd.Series Observed cumulative returns. preds : numpy.array Multiple (simulated) cumulative returns. Returns ------- Consistency score ...
def compute_consistency_score(returns_test, preds): """ Compute Bayesian consistency score. Parameters ---------- returns_test : pd.Series Observed cumulative returns. preds : numpy.array Multiple (simulated) cumulative returns. Returns ------- Consistency score ...
[ "Compute", "Bayesian", "consistency", "score", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L456-L484
[ "def", "compute_consistency_score", "(", "returns_test", ",", "preds", ")", ":", "returns_test_cum", "=", "cum_returns", "(", "returns_test", ",", "starting_value", "=", "1.", ")", "cum_preds", "=", "np", ".", "cumprod", "(", "preds", "+", "1", ",", "1", ")"...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
run_model
Run one of the Bayesian models. Parameters ---------- model : {'alpha_beta', 't', 'normal', 'best'} Which model to run returns_train : pd.Series Timeseries of simple returns returns_test : pd.Series (optional) Out-of-sample returns. Datetimes in returns_test will be added to...
pyfolio/bayesian.py
def run_model(model, returns_train, returns_test=None, bmark=None, samples=500, ppc=False, progressbar=True): """ Run one of the Bayesian models. Parameters ---------- model : {'alpha_beta', 't', 'normal', 'best'} Which model to run returns_train : pd.Series Timese...
def run_model(model, returns_train, returns_test=None, bmark=None, samples=500, ppc=False, progressbar=True): """ Run one of the Bayesian models. Parameters ---------- model : {'alpha_beta', 't', 'normal', 'best'} Which model to run returns_train : pd.Series Timese...
[ "Run", "one", "of", "the", "Bayesian", "models", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L522-L584
[ "def", "run_model", "(", "model", ",", "returns_train", ",", "returns_test", "=", "None", ",", "bmark", "=", "None", ",", "samples", "=", "500", ",", "ppc", "=", "False", ",", "progressbar", "=", "True", ")", ":", "if", "model", "==", "'alpha_beta'", "...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
plot_bayes_cone
Generate cumulative returns plot with Bayesian cone. Parameters ---------- returns_train : pd.Series Timeseries of simple returns returns_test : pd.Series Out-of-sample returns. Datetimes in returns_test will be added to returns_train as missing values and predictions will be ge...
pyfolio/bayesian.py
def plot_bayes_cone(returns_train, returns_test, ppc, plot_train_len=50, ax=None): """ Generate cumulative returns plot with Bayesian cone. Parameters ---------- returns_train : pd.Series Timeseries of simple returns returns_test : pd.Series Out-of-sample ret...
def plot_bayes_cone(returns_train, returns_test, ppc, plot_train_len=50, ax=None): """ Generate cumulative returns plot with Bayesian cone. Parameters ---------- returns_train : pd.Series Timeseries of simple returns returns_test : pd.Series Out-of-sample ret...
[ "Generate", "cumulative", "returns", "plot", "with", "Bayesian", "cone", "." ]
quantopian/pyfolio
python
https://github.com/quantopian/pyfolio/blob/712716ab0cdebbec9fabb25eea3bf40e4354749d/pyfolio/bayesian.py#L587-L638
[ "def", "plot_bayes_cone", "(", "returns_train", ",", "returns_test", ",", "ppc", ",", "plot_train_len", "=", "50", ",", "ax", "=", "None", ")", ":", "score", "=", "compute_consistency_score", "(", "returns_test", ",", "ppc", ")", "ax", "=", "_plot_bayes_cone",...
712716ab0cdebbec9fabb25eea3bf40e4354749d
valid
load_voc_dataset
Pascal VOC 2007/2012 Dataset. It has 20 objects: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor and additional 3 classes : head, hand, foot for person. Parameters ----------- path : str ...
tensorlayer/files/dataset_loaders/voc_dataset.py
def load_voc_dataset(path='data', dataset='2012', contain_classes_in_person=False): """Pascal VOC 2007/2012 Dataset. It has 20 objects: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor and additiona...
def load_voc_dataset(path='data', dataset='2012', contain_classes_in_person=False): """Pascal VOC 2007/2012 Dataset. It has 20 objects: aeroplane, bicycle, bird, boat, bottle, bus, car, cat, chair, cow, diningtable, dog, horse, motorbike, person, pottedplant, sheep, sofa, train, tvmonitor and additiona...
[ "Pascal", "VOC", "2007", "/", "2012", "Dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/dataset_loaders/voc_dataset.py#L23-L338
[ "def", "load_voc_dataset", "(", "path", "=", "'data'", ",", "dataset", "=", "'2012'", ",", "contain_classes_in_person", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'VOC'", ")", "def", "_recursive_parse_xml_to_dict"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
main
The core of the model consists of an LSTM cell that processes one word at a time and computes probabilities of the possible continuations of the sentence. The memory state of the network is initialized with a vector of zeros and gets updated after reading each word. Also, for computational reasons, we w...
examples/text_ptb/tutorial_ptb_lstm.py
def main(_): """ The core of the model consists of an LSTM cell that processes one word at a time and computes probabilities of the possible continuations of the sentence. The memory state of the network is initialized with a vector of zeros and gets updated after reading each word. Also, for comput...
def main(_): """ The core of the model consists of an LSTM cell that processes one word at a time and computes probabilities of the possible continuations of the sentence. The memory state of the network is initialized with a vector of zeros and gets updated after reading each word. Also, for comput...
[ "The", "core", "of", "the", "model", "consists", "of", "an", "LSTM", "cell", "that", "processes", "one", "word", "at", "a", "time", "and", "computes", "probabilities", "of", "the", "possible", "continuations", "of", "the", "sentence", ".", "The", "memory", ...
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/examples/text_ptb/tutorial_ptb_lstm.py#L126-L377
[ "def", "main", "(", "_", ")", ":", "if", "FLAGS", ".", "model", "==", "\"small\"", ":", "init_scale", "=", "0.1", "learning_rate", "=", "1.0", "max_grad_norm", "=", "5", "num_steps", "=", "20", "hidden_size", "=", "200", "max_epoch", "=", "4", "max_max_e...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
private_method
Decorator for making an instance method private.
tensorlayer/decorators/method_decorator.py
def private_method(func): """Decorator for making an instance method private.""" def func_wrapper(*args, **kwargs): """Decorator wrapper function.""" outer_frame = inspect.stack()[1][0] if 'self' not in outer_frame.f_locals or outer_frame.f_locals['self'] is not args[0]: rai...
def private_method(func): """Decorator for making an instance method private.""" def func_wrapper(*args, **kwargs): """Decorator wrapper function.""" outer_frame = inspect.stack()[1][0] if 'self' not in outer_frame.f_locals or outer_frame.f_locals['self'] is not args[0]: rai...
[ "Decorator", "for", "making", "an", "instance", "method", "private", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/decorators/method_decorator.py#L7-L18
[ "def", "private_method", "(", "func", ")", ":", "def", "func_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Decorator wrapper function.\"\"\"", "outer_frame", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "0", "]", "i...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
protected_method
Decorator for making an instance method private.
tensorlayer/decorators/method_decorator.py
def protected_method(func): """Decorator for making an instance method private.""" def func_wrapper(*args, **kwargs): """Decorator wrapper function.""" outer_frame = inspect.stack()[1][0] caller = inspect.getmro(outer_frame.f_locals['self'].__class__)[:-1] target = inspect.getm...
def protected_method(func): """Decorator for making an instance method private.""" def func_wrapper(*args, **kwargs): """Decorator wrapper function.""" outer_frame = inspect.stack()[1][0] caller = inspect.getmro(outer_frame.f_locals['self'].__class__)[:-1] target = inspect.getm...
[ "Decorator", "for", "making", "an", "instance", "method", "private", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/decorators/method_decorator.py#L21-L44
[ "def", "protected_method", "(", "func", ")", ":", "def", "func_wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"Decorator wrapper function.\"\"\"", "outer_frame", "=", "inspect", ".", "stack", "(", ")", "[", "1", "]", "[", "0", "]", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
atrous_conv1d
Simplified version of :class:`AtrousConv1dLayer`. Parameters ---------- prev_layer : :class:`Layer` Previous layer. n_filter : int The number of filters. filter_size : int The filter size. stride : tuple of int The strides: (height, width). dilation : int ...
tensorlayer/layers/convolution/atrous_conv.py
def atrous_conv1d( prev_layer, n_filter=32, filter_size=2, stride=1, dilation=1, act=None, padding='SAME', data_format='NWC', W_init=tf.truncated_normal_initializer(stddev=0.02), b_init=tf.constant_initializer(value=0.0), W_init_arg...
def atrous_conv1d( prev_layer, n_filter=32, filter_size=2, stride=1, dilation=1, act=None, padding='SAME', data_format='NWC', W_init=tf.truncated_normal_initializer(stddev=0.02), b_init=tf.constant_initializer(value=0.0), W_init_arg...
[ "Simplified", "version", "of", ":", "class", ":", "AtrousConv1dLayer", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/convolution/atrous_conv.py#L23-L88
[ "def", "atrous_conv1d", "(", "prev_layer", ",", "n_filter", "=", "32", ",", "filter_size", "=", "2", ",", "stride", "=", "1", ",", "dilation", "=", "1", ",", "act", "=", "None", ",", "padding", "=", "'SAME'", ",", "data_format", "=", "'NWC'", ",", "W...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
_GetNextLogCountPerToken
Wrapper for _log_counter_per_token. Args: token: The token for which to look up the count. Returns: The number of times this function has been called with *token* as an argument (starting at 0)
tensorlayer/logging/tl_logging.py
def _GetNextLogCountPerToken(token): """Wrapper for _log_counter_per_token. Args: token: The token for which to look up the count. Returns: The number of times this function has been called with *token* as an argument (starting at 0) """ global _log_counter_per_token # pylint: disable...
def _GetNextLogCountPerToken(token): """Wrapper for _log_counter_per_token. Args: token: The token for which to look up the count. Returns: The number of times this function has been called with *token* as an argument (starting at 0) """ global _log_counter_per_token # pylint: disable...
[ "Wrapper", "for", "_log_counter_per_token", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L148-L160
[ "def", "_GetNextLogCountPerToken", "(", "token", ")", ":", "global", "_log_counter_per_token", "# pylint: disable=global-variable-not-assigned", "_log_counter_per_token", "[", "token", "]", "=", "1", "+", "_log_counter_per_token", ".", "get", "(", "token", ",", "-", "1"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
log_every_n
Log 'msg % args' at level 'level' once per 'n' times. Logs the 1st call, (N+1)st call, (2N+1)st call, etc. Not threadsafe. Args: level: The level at which to log. msg: The message to be logged. n: The number of times this should be called before it is logged. *args: The args to be substit...
tensorlayer/logging/tl_logging.py
def log_every_n(level, msg, n, *args): """Log 'msg % args' at level 'level' once per 'n' times. Logs the 1st call, (N+1)st call, (2N+1)st call, etc. Not threadsafe. Args: level: The level at which to log. msg: The message to be logged. n: The number of times this should be called before i...
def log_every_n(level, msg, n, *args): """Log 'msg % args' at level 'level' once per 'n' times. Logs the 1st call, (N+1)st call, (2N+1)st call, etc. Not threadsafe. Args: level: The level at which to log. msg: The message to be logged. n: The number of times this should be called before i...
[ "Log", "msg", "%", "args", "at", "level", "level", "once", "per", "n", "times", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L163-L176
[ "def", "log_every_n", "(", "level", ",", "msg", ",", "n", ",", "*", "args", ")", ":", "count", "=", "_GetNextLogCountPerToken", "(", "_GetFileAndLine", "(", ")", ")", "log_if", "(", "level", ",", "msg", ",", "not", "(", "count", "%", "n", ")", ",", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
log_if
Log 'msg % args' at level 'level' only if condition is fulfilled.
tensorlayer/logging/tl_logging.py
def log_if(level, msg, condition, *args): """Log 'msg % args' at level 'level' only if condition is fulfilled.""" if condition: vlog(level, msg, *args)
def log_if(level, msg, condition, *args): """Log 'msg % args' at level 'level' only if condition is fulfilled.""" if condition: vlog(level, msg, *args)
[ "Log", "msg", "%", "args", "at", "level", "level", "only", "if", "condition", "is", "fulfilled", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L194-L197
[ "def", "log_if", "(", "level", ",", "msg", ",", "condition", ",", "*", "args", ")", ":", "if", "condition", ":", "vlog", "(", "level", ",", "msg", ",", "*", "args", ")" ]
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
_GetFileAndLine
Returns (filename, linenumber) for the stack frame.
tensorlayer/logging/tl_logging.py
def _GetFileAndLine(): """Returns (filename, linenumber) for the stack frame.""" # Use sys._getframe(). This avoids creating a traceback object. # pylint: disable=protected-access f = _sys._getframe() # pylint: enable=protected-access our_file = f.f_code.co_filename f = f.f_back while f...
def _GetFileAndLine(): """Returns (filename, linenumber) for the stack frame.""" # Use sys._getframe(). This avoids creating a traceback object. # pylint: disable=protected-access f = _sys._getframe() # pylint: enable=protected-access our_file = f.f_code.co_filename f = f.f_back while f...
[ "Returns", "(", "filename", "linenumber", ")", "for", "the", "stack", "frame", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L200-L213
[ "def", "_GetFileAndLine", "(", ")", ":", "# Use sys._getframe(). This avoids creating a traceback object.", "# pylint: disable=protected-access", "f", "=", "_sys", ".", "_getframe", "(", ")", "# pylint: enable=protected-access", "our_file", "=", "f", ".", "f_code", ".", "c...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
google2_log_prefix
Assemble a logline prefix using the google2 format.
tensorlayer/logging/tl_logging.py
def google2_log_prefix(level, timestamp=None, file_and_line=None): """Assemble a logline prefix using the google2 format.""" # pylint: disable=global-variable-not-assigned global _level_names # pylint: enable=global-variable-not-assigned # Record current time now = timestamp or _time.time() ...
def google2_log_prefix(level, timestamp=None, file_and_line=None): """Assemble a logline prefix using the google2 format.""" # pylint: disable=global-variable-not-assigned global _level_names # pylint: enable=global-variable-not-assigned # Record current time now = timestamp or _time.time() ...
[ "Assemble", "a", "logline", "prefix", "using", "the", "google2", "format", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/logging/tl_logging.py#L216-L248
[ "def", "google2_log_prefix", "(", "level", ",", "timestamp", "=", "None", ",", "file_and_line", "=", "None", ")", ":", "# pylint: disable=global-variable-not-assigned", "global", "_level_names", "# pylint: enable=global-variable-not-assigned", "# Record current time", "now", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_mpii_pose_dataset
Load MPII Human Pose Dataset. Parameters ----------- path : str The path that the data is downloaded to. is_16_pos_only : boolean If True, only return the peoples contain 16 pose keypoints. (Usually be used for single person pose estimation) Returns ---------- img_train_lis...
tensorlayer/files/dataset_loaders/mpii_dataset.py
def load_mpii_pose_dataset(path='data', is_16_pos_only=False): """Load MPII Human Pose Dataset. Parameters ----------- path : str The path that the data is downloaded to. is_16_pos_only : boolean If True, only return the peoples contain 16 pose keypoints. (Usually be used for single...
def load_mpii_pose_dataset(path='data', is_16_pos_only=False): """Load MPII Human Pose Dataset. Parameters ----------- path : str The path that the data is downloaded to. is_16_pos_only : boolean If True, only return the peoples contain 16 pose keypoints. (Usually be used for single...
[ "Load", "MPII", "Human", "Pose", "Dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/dataset_loaders/mpii_dataset.py#L16-L256
[ "def", "load_mpii_pose_dataset", "(", "path", "=", "'data'", ",", "is_16_pos_only", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'mpii_human_pose'", ")", "logging", ".", "info", "(", "\"Load or Download MPII Human Pos...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
transformer
Spatial Transformer Layer for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__ , see :class:`SpatialTransformer2dAffineLayer` class. Parameters ---------- U : list of float The output of a convolutional net should have the shape [num_batch, height, widt...
tensorlayer/layers/spatial_transformer.py
def transformer(U, theta, out_size, name='SpatialTransformer2dAffine'): """Spatial Transformer Layer for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__ , see :class:`SpatialTransformer2dAffineLayer` class. Parameters ---------- U : list of float The outpu...
def transformer(U, theta, out_size, name='SpatialTransformer2dAffine'): """Spatial Transformer Layer for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__ , see :class:`SpatialTransformer2dAffineLayer` class. Parameters ---------- U : list of float The outpu...
[ "Spatial", "Transformer", "Layer", "for", "2D", "Affine", "Transformation", "<https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Affine_transformation", ">", "__", "see", ":", "class", ":", "SpatialTransformer2dAffineLayer", "class", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/spatial_transformer.py#L28-L188
[ "def", "transformer", "(", "U", ",", "theta", ",", "out_size", ",", "name", "=", "'SpatialTransformer2dAffine'", ")", ":", "def", "_repeat", "(", "x", ",", "n_repeats", ")", ":", "with", "tf", ".", "variable_scope", "(", "'_repeat'", ")", ":", "rep", "="...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
batch_transformer
Batch Spatial Transformer function for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__. Parameters ---------- U : list of float tensor of inputs [batch, height, width, num_channels] thetas : list of float a set of transformations for each input [batch,...
tensorlayer/layers/spatial_transformer.py
def batch_transformer(U, thetas, out_size, name='BatchSpatialTransformer2dAffine'): """Batch Spatial Transformer function for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__. Parameters ---------- U : list of float tensor of inputs [batch, height, width, num_c...
def batch_transformer(U, thetas, out_size, name='BatchSpatialTransformer2dAffine'): """Batch Spatial Transformer function for `2D Affine Transformation <https://en.wikipedia.org/wiki/Affine_transformation>`__. Parameters ---------- U : list of float tensor of inputs [batch, height, width, num_c...
[ "Batch", "Spatial", "Transformer", "function", "for", "2D", "Affine", "Transformation", "<https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Affine_transformation", ">", "__", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/layers/spatial_transformer.py#L191-L215
[ "def", "batch_transformer", "(", "U", ",", "thetas", ",", "out_size", ",", "name", "=", "'BatchSpatialTransformer2dAffine'", ")", ":", "with", "tf", ".", "variable_scope", "(", "name", ")", ":", "num_batch", ",", "num_transforms", "=", "map", "(", "int", ","...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
create_task_spec_def
Returns the a :class:`TaskSpecDef` based on the environment variables for distributed training. References ---------- - `ML-engine trainer considerations <https://cloud.google.com/ml-engine/docs/trainer-considerations#use_tf_config>`__ - `TensorPort Distributed Computing <https://www.tensorport.com/doc...
tensorlayer/distributed.py
def create_task_spec_def(): """Returns the a :class:`TaskSpecDef` based on the environment variables for distributed training. References ---------- - `ML-engine trainer considerations <https://cloud.google.com/ml-engine/docs/trainer-considerations#use_tf_config>`__ - `TensorPort Distributed Comput...
def create_task_spec_def(): """Returns the a :class:`TaskSpecDef` based on the environment variables for distributed training. References ---------- - `ML-engine trainer considerations <https://cloud.google.com/ml-engine/docs/trainer-considerations#use_tf_config>`__ - `TensorPort Distributed Comput...
[ "Returns", "the", "a", ":", "class", ":", "TaskSpecDef", "based", "on", "the", "environment", "variables", "for", "distributed", "training", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/distributed.py#L368-L394
[ "def", "create_task_spec_def", "(", ")", ":", "if", "'TF_CONFIG'", "in", "os", ".", "environ", ":", "# TF_CONFIG is used in ML-engine", "env", "=", "json", ".", "loads", "(", "os", ".", "environ", ".", "get", "(", "'TF_CONFIG'", ",", "'{}'", ")", ")", "tas...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
create_distributed_session
Creates a distributed session. It calls `MonitoredTrainingSession` to create a :class:`MonitoredSession` for distributed training. Parameters ---------- task_spec : :class:`TaskSpecDef`. The task spec definition from create_task_spec_def() checkpoint_dir : str. Optional path to a d...
tensorlayer/distributed.py
def create_distributed_session( task_spec=None, checkpoint_dir=None, scaffold=None, hooks=None, chief_only_hooks=None, save_checkpoint_secs=600, save_summaries_steps=object(), save_summaries_secs=object(), config=None, stop_grace_period_secs=120, log_step_count_steps=100 ): """Creates a dist...
def create_distributed_session( task_spec=None, checkpoint_dir=None, scaffold=None, hooks=None, chief_only_hooks=None, save_checkpoint_secs=600, save_summaries_steps=object(), save_summaries_secs=object(), config=None, stop_grace_period_secs=120, log_step_count_steps=100 ): """Creates a dist...
[ "Creates", "a", "distributed", "session", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/distributed.py#L398-L491
[ "def", "create_distributed_session", "(", "task_spec", "=", "None", ",", "checkpoint_dir", "=", "None", ",", "scaffold", "=", "None", ",", "hooks", "=", "None", ",", "chief_only_hooks", "=", "None", ",", "save_checkpoint_secs", "=", "600", ",", "save_summaries_s...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
Trainer.validation_metrics
A helper function to compute validation related metrics
tensorlayer/distributed.py
def validation_metrics(self): """A helper function to compute validation related metrics""" if (self._validation_iterator is None) or (self._validation_metrics is None): raise AttributeError('Validation is not setup.') n = 0.0 metric_sums = [0.0] * len(self._validation_metr...
def validation_metrics(self): """A helper function to compute validation related metrics""" if (self._validation_iterator is None) or (self._validation_metrics is None): raise AttributeError('Validation is not setup.') n = 0.0 metric_sums = [0.0] * len(self._validation_metr...
[ "A", "helper", "function", "to", "compute", "validation", "related", "metrics" ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/distributed.py#L187-L206
[ "def", "validation_metrics", "(", "self", ")", ":", "if", "(", "self", ".", "_validation_iterator", "is", "None", ")", "or", "(", "self", ".", "_validation_metrics", "is", "None", ")", ":", "raise", "AttributeError", "(", "'Validation is not setup.'", ")", "n"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
Trainer.train_and_validate_to_end
A helper function that shows how to train and validate a model at the same time. Parameters ---------- validate_step_size : int Validate the training network every N steps.
tensorlayer/distributed.py
def train_and_validate_to_end(self, validate_step_size=50): """A helper function that shows how to train and validate a model at the same time. Parameters ---------- validate_step_size : int Validate the training network every N steps. """ while not self._se...
def train_and_validate_to_end(self, validate_step_size=50): """A helper function that shows how to train and validate a model at the same time. Parameters ---------- validate_step_size : int Validate the training network every N steps. """ while not self._se...
[ "A", "helper", "function", "that", "shows", "how", "to", "train", "and", "validate", "a", "model", "at", "the", "same", "time", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/distributed.py#L212-L228
[ "def", "train_and_validate_to_end", "(", "self", ",", "validate_step_size", "=", "50", ")", ":", "while", "not", "self", ".", "_sess", ".", "should_stop", "(", ")", ":", "self", ".", "train_on_batch", "(", ")", "# Run a training step synchronously.", "if", "self...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
_load_mnist_dataset
A generic function to load mnist-like dataset. Parameters: ---------- shape : tuple The shape of digit images. path : str The path that the data is downloaded to. name : str The dataset name you want to use(the default is 'mnist'). url : str The url of dataset(th...
tensorlayer/files/utils.py
def _load_mnist_dataset(shape, path, name='mnist', url='http://yann.lecun.com/exdb/mnist/'): """A generic function to load mnist-like dataset. Parameters: ---------- shape : tuple The shape of digit images. path : str The path that the data is downloaded to. name : str T...
def _load_mnist_dataset(shape, path, name='mnist', url='http://yann.lecun.com/exdb/mnist/'): """A generic function to load mnist-like dataset. Parameters: ---------- shape : tuple The shape of digit images. path : str The path that the data is downloaded to. name : str T...
[ "A", "generic", "function", "to", "load", "mnist", "-", "like", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L135-L195
[ "def", "_load_mnist_dataset", "(", "shape", ",", "path", ",", "name", "=", "'mnist'", ",", "url", "=", "'http://yann.lecun.com/exdb/mnist/'", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "name", ")", "# Define functions for loading ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_cifar10_dataset
Load CIFAR-10 dataset. It consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. The dataset is divided into five training batches and one test batch, each with 10000 images. The test batch contains exactly 1000 randomly-...
tensorlayer/files/utils.py
def load_cifar10_dataset(shape=(-1, 32, 32, 3), path='data', plotable=False): """Load CIFAR-10 dataset. It consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. The dataset is divided into five training batches and one t...
def load_cifar10_dataset(shape=(-1, 32, 32, 3), path='data', plotable=False): """Load CIFAR-10 dataset. It consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images. The dataset is divided into five training batches and one t...
[ "Load", "CIFAR", "-", "10", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L198-L313
[ "def", "load_cifar10_dataset", "(", "shape", "=", "(", "-", "1", ",", "32", ",", "32", ",", "3", ")", ",", "path", "=", "'data'", ",", "plotable", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'cifar10'",...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_cropped_svhn
Load Cropped SVHN. The Cropped Street View House Numbers (SVHN) Dataset contains 32x32x3 RGB images. Digit '1' has label 1, '9' has label 9 and '0' has label 0 (the original dataset uses 10 to represent '0'), see `ufldl website <http://ufldl.stanford.edu/housenumbers/>`__. Parameters ---------- pa...
tensorlayer/files/utils.py
def load_cropped_svhn(path='data', include_extra=True): """Load Cropped SVHN. The Cropped Street View House Numbers (SVHN) Dataset contains 32x32x3 RGB images. Digit '1' has label 1, '9' has label 9 and '0' has label 0 (the original dataset uses 10 to represent '0'), see `ufldl website <http://ufldl.stanfo...
def load_cropped_svhn(path='data', include_extra=True): """Load Cropped SVHN. The Cropped Street View House Numbers (SVHN) Dataset contains 32x32x3 RGB images. Digit '1' has label 1, '9' has label 9 and '0' has label 0 (the original dataset uses 10 to represent '0'), see `ufldl website <http://ufldl.stanfo...
[ "Load", "Cropped", "SVHN", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L316-L410
[ "def", "load_cropped_svhn", "(", "path", "=", "'data'", ",", "include_extra", "=", "True", ")", ":", "start_time", "=", "time", ".", "time", "(", ")", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'cropped_svhn'", ")", "logging", ".",...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_ptb_dataset
Load Penn TreeBank (PTB) dataset. It is used in many LANGUAGE MODELING papers, including "Empirical Evaluation and Combination of Advanced Language Modeling Techniques", "Recurrent Neural Network Regularization". It consists of 929k training words, 73k validation words, and 82k test words. It has 1...
tensorlayer/files/utils.py
def load_ptb_dataset(path='data'): """Load Penn TreeBank (PTB) dataset. It is used in many LANGUAGE MODELING papers, including "Empirical Evaluation and Combination of Advanced Language Modeling Techniques", "Recurrent Neural Network Regularization". It consists of 929k training words, 73k validati...
def load_ptb_dataset(path='data'): """Load Penn TreeBank (PTB) dataset. It is used in many LANGUAGE MODELING papers, including "Empirical Evaluation and Combination of Advanced Language Modeling Techniques", "Recurrent Neural Network Regularization". It consists of 929k training words, 73k validati...
[ "Load", "Penn", "TreeBank", "(", "PTB", ")", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L413-L473
[ "def", "load_ptb_dataset", "(", "path", "=", "'data'", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'ptb'", ")", "logging", ".", "info", "(", "\"Load or Download Penn TreeBank (PTB) dataset > {}\"", ".", "format", "(", "path", ")...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_matt_mahoney_text8_dataset
Load Matt Mahoney's dataset. Download a text file from Matt Mahoney's website if not present, and make sure it's the right size. Extract the first file enclosed in a zip file as a list of words. This dataset can be used for Word Embedding. Parameters ---------- path : str The path ...
tensorlayer/files/utils.py
def load_matt_mahoney_text8_dataset(path='data'): """Load Matt Mahoney's dataset. Download a text file from Matt Mahoney's website if not present, and make sure it's the right size. Extract the first file enclosed in a zip file as a list of words. This dataset can be used for Word Embedding. P...
def load_matt_mahoney_text8_dataset(path='data'): """Load Matt Mahoney's dataset. Download a text file from Matt Mahoney's website if not present, and make sure it's the right size. Extract the first file enclosed in a zip file as a list of words. This dataset can be used for Word Embedding. P...
[ "Load", "Matt", "Mahoney", "s", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L476-L511
[ "def", "load_matt_mahoney_text8_dataset", "(", "path", "=", "'data'", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'mm_test8'", ")", "logging", ".", "info", "(", "\"Load or Download matt_mahoney_text8 Dataset> {}\"", ".", "format", "...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_imdb_dataset
Load IMDB dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/imdb/``. nb_words : int Number of words to get. skip_top : int Top most frequent words to ignore (they will appear as oov_char value in the sequence data). max...
tensorlayer/files/utils.py
def load_imdb_dataset( path='data', nb_words=None, skip_top=0, maxlen=None, test_split=0.2, seed=113, start_char=1, oov_char=2, index_from=3 ): """Load IMDB dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/imdb/``. nb_word...
def load_imdb_dataset( path='data', nb_words=None, skip_top=0, maxlen=None, test_split=0.2, seed=113, start_char=1, oov_char=2, index_from=3 ): """Load IMDB dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/imdb/``. nb_word...
[ "Load", "IMDB", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L514-L614
[ "def", "load_imdb_dataset", "(", "path", "=", "'data'", ",", "nb_words", "=", "None", ",", "skip_top", "=", "0", ",", "maxlen", "=", "None", ",", "test_split", "=", "0.2", ",", "seed", "=", "113", ",", "start_char", "=", "1", ",", "oov_char", "=", "2...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_nietzsche_dataset
Load Nietzsche dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/nietzsche/``. Returns -------- str The content. Examples -------- >>> see tutorial_generate_text.py >>> words = tl.files.load_nietzsche_dataset(...
tensorlayer/files/utils.py
def load_nietzsche_dataset(path='data'): """Load Nietzsche dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/nietzsche/``. Returns -------- str The content. Examples -------- >>> see tutorial_generate_text.py ...
def load_nietzsche_dataset(path='data'): """Load Nietzsche dataset. Parameters ---------- path : str The path that the data is downloaded to, defaults is ``data/nietzsche/``. Returns -------- str The content. Examples -------- >>> see tutorial_generate_text.py ...
[ "Load", "Nietzsche", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L617-L647
[ "def", "load_nietzsche_dataset", "(", "path", "=", "'data'", ")", ":", "logging", ".", "info", "(", "\"Load or Download nietzsche dataset > {}\"", ".", "format", "(", "path", ")", ")", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'nietzsch...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_wmt_en_fr_dataset
Load WMT'15 English-to-French translation dataset. It will download the data from the WMT'15 Website (10^9-French-English corpus), and the 2013 news test from the same site as development set. Returns the directories of training data and test data. Parameters ---------- path : str The path...
tensorlayer/files/utils.py
def load_wmt_en_fr_dataset(path='data'): """Load WMT'15 English-to-French translation dataset. It will download the data from the WMT'15 Website (10^9-French-English corpus), and the 2013 news test from the same site as development set. Returns the directories of training data and test data. Parameter...
def load_wmt_en_fr_dataset(path='data'): """Load WMT'15 English-to-French translation dataset. It will download the data from the WMT'15 Website (10^9-French-English corpus), and the 2013 news test from the same site as development set. Returns the directories of training data and test data. Parameter...
[ "Load", "WMT", "15", "English", "-", "to", "-", "French", "translation", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L650-L714
[ "def", "load_wmt_en_fr_dataset", "(", "path", "=", "'data'", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'wmt_en_fr'", ")", "# URLs for WMT data.", "_WMT_ENFR_TRAIN_URL", "=", "\"http://www.statmt.org/wmt10/\"", "_WMT_ENFR_DEV_URL", "="...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_flickr25k_dataset
Load Flickr25K dataset. Returns a list of images by a given tag from Flick25k dataset, it will download Flickr25k from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time you use it. Parameters ------------ tag : str or None What images to retu...
tensorlayer/files/utils.py
def load_flickr25k_dataset(tag='sky', path="data", n_threads=50, printable=False): """Load Flickr25K dataset. Returns a list of images by a given tag from Flick25k dataset, it will download Flickr25k from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time you ...
def load_flickr25k_dataset(tag='sky', path="data", n_threads=50, printable=False): """Load Flickr25K dataset. Returns a list of images by a given tag from Flick25k dataset, it will download Flickr25k from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time you ...
[ "Load", "Flickr25K", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L717-L784
[ "def", "load_flickr25k_dataset", "(", "tag", "=", "'sky'", ",", "path", "=", "\"data\"", ",", "n_threads", "=", "50", ",", "printable", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'flickr25k'", ")", "filename...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_flickr1M_dataset
Load Flick1M dataset. Returns a list of images by a given tag from Flickr1M dataset, it will download Flickr1M from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time you use it. Parameters ------------ tag : str or None What images to return....
tensorlayer/files/utils.py
def load_flickr1M_dataset(tag='sky', size=10, path="data", n_threads=50, printable=False): """Load Flick1M dataset. Returns a list of images by a given tag from Flickr1M dataset, it will download Flickr1M from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time...
def load_flickr1M_dataset(tag='sky', size=10, path="data", n_threads=50, printable=False): """Load Flick1M dataset. Returns a list of images by a given tag from Flickr1M dataset, it will download Flickr1M from `the official website <http://press.liacs.nl/mirflickr/mirdownload.html>`__ at the first time...
[ "Load", "Flick1M", "dataset", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L787-L887
[ "def", "load_flickr1M_dataset", "(", "tag", "=", "'sky'", ",", "size", "=", "10", ",", "path", "=", "\"data\"", ",", "n_threads", "=", "50", ",", "printable", "=", "False", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_cyclegan_dataset
Load images from CycleGAN's database, see `this link <https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/>`__. Parameters ------------ filename : str The dataset you want, see `this link <https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/>`__. path : str The...
tensorlayer/files/utils.py
def load_cyclegan_dataset(filename='summer2winter_yosemite', path='data'): """Load images from CycleGAN's database, see `this link <https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/>`__. Parameters ------------ filename : str The dataset you want, see `this link <https://people....
def load_cyclegan_dataset(filename='summer2winter_yosemite', path='data'): """Load images from CycleGAN's database, see `this link <https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/>`__. Parameters ------------ filename : str The dataset you want, see `this link <https://people....
[ "Load", "images", "from", "CycleGAN", "s", "database", "see", "this", "link", "<https", ":", "//", "people", ".", "eecs", ".", "berkeley", ".", "edu", "/", "~taesung_park", "/", "CycleGAN", "/", "datasets", "/", ">", "__", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L890-L934
[ "def", "load_cyclegan_dataset", "(", "filename", "=", "'summer2winter_yosemite'", ",", "path", "=", "'data'", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "'cyclegan'", ")", "url", "=", "'https://people.eecs.berkeley.edu/~taesung_park/C...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
download_file_from_google_drive
Download file from Google Drive. See ``tl.files.load_celebA_dataset`` for example. Parameters -------------- ID : str The driver ID. destination : str The destination for save file.
tensorlayer/files/utils.py
def download_file_from_google_drive(ID, destination): """Download file from Google Drive. See ``tl.files.load_celebA_dataset`` for example. Parameters -------------- ID : str The driver ID. destination : str The destination for save file. """ def save_response_content...
def download_file_from_google_drive(ID, destination): """Download file from Google Drive. See ``tl.files.load_celebA_dataset`` for example. Parameters -------------- ID : str The driver ID. destination : str The destination for save file. """ def save_response_content...
[ "Download", "file", "from", "Google", "Drive", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L937-L974
[ "def", "download_file_from_google_drive", "(", "ID", ",", "destination", ")", ":", "def", "save_response_content", "(", "response", ",", "destination", ",", "chunk_size", "=", "32", "*", "1024", ")", ":", "total_size", "=", "int", "(", "response", ".", "header...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_celebA_dataset
Load CelebA dataset Return a list of image path. Parameters ----------- path : str The path that the data is downloaded to, defaults is ``data/celebA/``.
tensorlayer/files/utils.py
def load_celebA_dataset(path='data'): """Load CelebA dataset Return a list of image path. Parameters ----------- path : str The path that the data is downloaded to, defaults is ``data/celebA/``. """ data_dir = 'celebA' filename, drive_id = "img_align_celeba.zip", "0B7EVK8r0v71...
def load_celebA_dataset(path='data'): """Load CelebA dataset Return a list of image path. Parameters ----------- path : str The path that the data is downloaded to, defaults is ``data/celebA/``. """ data_dir = 'celebA' filename, drive_id = "img_align_celeba.zip", "0B7EVK8r0v71...
[ "Load", "CelebA", "dataset" ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L977-L1007
[ "def", "load_celebA_dataset", "(", "path", "=", "'data'", ")", ":", "data_dir", "=", "'celebA'", "filename", ",", "drive_id", "=", "\"img_align_celeba.zip\"", ",", "\"0B7EVK8r0v71pZjFTYXZWM3FlRnM\"", "save_path", "=", "os", ".", "path", ".", "join", "(", "path", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
save_npz
Input parameters and the file name, save parameters into .npz file. Use tl.utils.load_npz() to restore. Parameters ---------- save_list : list of tensor A list of parameters (tensor) to be saved. name : str The name of the `.npz` file. sess : None or Session Session may be r...
tensorlayer/files/utils.py
def save_npz(save_list=None, name='model.npz', sess=None): """Input parameters and the file name, save parameters into .npz file. Use tl.utils.load_npz() to restore. Parameters ---------- save_list : list of tensor A list of parameters (tensor) to be saved. name : str The name of th...
def save_npz(save_list=None, name='model.npz', sess=None): """Input parameters and the file name, save parameters into .npz file. Use tl.utils.load_npz() to restore. Parameters ---------- save_list : list of tensor A list of parameters (tensor) to be saved. name : str The name of th...
[ "Input", "parameters", "and", "the", "file", "name", "save", "parameters", "into", ".", "npz", "file", ".", "Use", "tl", ".", "utils", ".", "load_npz", "()", "to", "restore", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1568-L1621
[ "def", "save_npz", "(", "save_list", "=", "None", ",", "name", "=", "'model.npz'", ",", "sess", "=", "None", ")", ":", "logging", ".", "info", "(", "\"[*] Saving TL params into %s\"", "%", "name", ")", "if", "save_list", "is", "None", ":", "save_list", "="...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_npz
Load the parameters of a Model saved by tl.files.save_npz(). Parameters ---------- path : str Folder path to `.npz` file. name : str The name of the `.npz` file. Returns -------- list of array A list of parameters in order. Examples -------- - See ``tl....
tensorlayer/files/utils.py
def load_npz(path='', name='model.npz'): """Load the parameters of a Model saved by tl.files.save_npz(). Parameters ---------- path : str Folder path to `.npz` file. name : str The name of the `.npz` file. Returns -------- list of array A list of parameters in o...
def load_npz(path='', name='model.npz'): """Load the parameters of a Model saved by tl.files.save_npz(). Parameters ---------- path : str Folder path to `.npz` file. name : str The name of the `.npz` file. Returns -------- list of array A list of parameters in o...
[ "Load", "the", "parameters", "of", "a", "Model", "saved", "by", "tl", ".", "files", ".", "save_npz", "()", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1624-L1649
[ "def", "load_npz", "(", "path", "=", "''", ",", "name", "=", "'model.npz'", ")", ":", "d", "=", "np", ".", "load", "(", "os", ".", "path", ".", "join", "(", "path", ",", "name", ")", ")", "return", "d", "[", "'params'", "]" ]
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
assign_params
Assign the given parameters to the TensorLayer network. Parameters ---------- sess : Session TensorFlow Session. params : list of array A list of parameters (array) in order. network : :class:`Layer` The network to be assigned. Returns -------- list of operation...
tensorlayer/files/utils.py
def assign_params(sess, params, network): """Assign the given parameters to the TensorLayer network. Parameters ---------- sess : Session TensorFlow Session. params : list of array A list of parameters (array) in order. network : :class:`Layer` The network to be assigned...
def assign_params(sess, params, network): """Assign the given parameters to the TensorLayer network. Parameters ---------- sess : Session TensorFlow Session. params : list of array A list of parameters (array) in order. network : :class:`Layer` The network to be assigned...
[ "Assign", "the", "given", "parameters", "to", "the", "TensorLayer", "network", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1652-L1683
[ "def", "assign_params", "(", "sess", ",", "params", ",", "network", ")", ":", "ops", "=", "[", "]", "for", "idx", ",", "param", "in", "enumerate", "(", "params", ")", ":", "ops", ".", "append", "(", "network", ".", "all_params", "[", "idx", "]", "....
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_and_assign_npz
Load model from npz and assign to a network. Parameters ------------- sess : Session TensorFlow Session. name : str The name of the `.npz` file. network : :class:`Layer` The network to be assigned. Returns -------- False or network Returns False, if the ...
tensorlayer/files/utils.py
def load_and_assign_npz(sess=None, name=None, network=None): """Load model from npz and assign to a network. Parameters ------------- sess : Session TensorFlow Session. name : str The name of the `.npz` file. network : :class:`Layer` The network to be assigned. Retu...
def load_and_assign_npz(sess=None, name=None, network=None): """Load model from npz and assign to a network. Parameters ------------- sess : Session TensorFlow Session. name : str The name of the `.npz` file. network : :class:`Layer` The network to be assigned. Retu...
[ "Load", "model", "from", "npz", "and", "assign", "to", "a", "network", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1686-L1719
[ "def", "load_and_assign_npz", "(", "sess", "=", "None", ",", "name", "=", "None", ",", "network", "=", "None", ")", ":", "if", "network", "is", "None", ":", "raise", "ValueError", "(", "\"network is None.\"", ")", "if", "sess", "is", "None", ":", "raise"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
save_npz_dict
Input parameters and the file name, save parameters as a dictionary into .npz file. Use ``tl.files.load_and_assign_npz_dict()`` to restore. Parameters ---------- save_list : list of parameters A list of parameters (tensor) to be saved. name : str The name of the `.npz` file. se...
tensorlayer/files/utils.py
def save_npz_dict(save_list=None, name='model.npz', sess=None): """Input parameters and the file name, save parameters as a dictionary into .npz file. Use ``tl.files.load_and_assign_npz_dict()`` to restore. Parameters ---------- save_list : list of parameters A list of parameters (tensor) ...
def save_npz_dict(save_list=None, name='model.npz', sess=None): """Input parameters and the file name, save parameters as a dictionary into .npz file. Use ``tl.files.load_and_assign_npz_dict()`` to restore. Parameters ---------- save_list : list of parameters A list of parameters (tensor) ...
[ "Input", "parameters", "and", "the", "file", "name", "save", "parameters", "as", "a", "dictionary", "into", ".", "npz", "file", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1722-L1750
[ "def", "save_npz_dict", "(", "save_list", "=", "None", ",", "name", "=", "'model.npz'", ",", "sess", "=", "None", ")", ":", "if", "sess", "is", "None", ":", "raise", "ValueError", "(", "\"session is None.\"", ")", "if", "save_list", "is", "None", ":", "s...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_and_assign_npz_dict
Restore the parameters saved by ``tl.files.save_npz_dict()``. Parameters ---------- name : str The name of the `.npz` file. sess : Session TensorFlow Session.
tensorlayer/files/utils.py
def load_and_assign_npz_dict(name='model.npz', sess=None): """Restore the parameters saved by ``tl.files.save_npz_dict()``. Parameters ---------- name : str The name of the `.npz` file. sess : Session TensorFlow Session. """ if sess is None: raise ValueError("sessio...
def load_and_assign_npz_dict(name='model.npz', sess=None): """Restore the parameters saved by ``tl.files.save_npz_dict()``. Parameters ---------- name : str The name of the `.npz` file. sess : Session TensorFlow Session. """ if sess is None: raise ValueError("sessio...
[ "Restore", "the", "parameters", "saved", "by", "tl", ".", "files", ".", "save_npz_dict", "()", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1753-L1791
[ "def", "load_and_assign_npz_dict", "(", "name", "=", "'model.npz'", ",", "sess", "=", "None", ")", ":", "if", "sess", "is", "None", ":", "raise", "ValueError", "(", "\"session is None.\"", ")", "if", "not", "os", ".", "path", ".", "exists", "(", "name", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
save_ckpt
Save parameters into `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``model.ckpt``. save_dir : str The path / file directory to the `ckpt`, default is ``checkpoint``. var_list : list of tensor ...
tensorlayer/files/utils.py
def save_ckpt( sess=None, mode_name='model.ckpt', save_dir='checkpoint', var_list=None, global_step=None, printable=False ): """Save parameters into `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``mo...
def save_ckpt( sess=None, mode_name='model.ckpt', save_dir='checkpoint', var_list=None, global_step=None, printable=False ): """Save parameters into `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``mo...
[ "Save", "parameters", "into", "ckpt", "file", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1794-L1835
[ "def", "save_ckpt", "(", "sess", "=", "None", ",", "mode_name", "=", "'model.ckpt'", ",", "save_dir", "=", "'checkpoint'", ",", "var_list", "=", "None", ",", "global_step", "=", "None", ",", "printable", "=", "False", ")", ":", "if", "sess", "is", "None"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_ckpt
Load parameters from `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``model.ckpt``. save_dir : str The path / file directory to the `ckpt`, default is ``checkpoint``. var_list : list of tensor ...
tensorlayer/files/utils.py
def load_ckpt(sess=None, mode_name='model.ckpt', save_dir='checkpoint', var_list=None, is_latest=True, printable=False): """Load parameters from `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``model.ckpt``. ...
def load_ckpt(sess=None, mode_name='model.ckpt', save_dir='checkpoint', var_list=None, is_latest=True, printable=False): """Load parameters from `ckpt` file. Parameters ------------ sess : Session TensorFlow Session. mode_name : str The name of the model, default is ``model.ckpt``. ...
[ "Load", "parameters", "from", "ckpt", "file", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L1838-L1899
[ "def", "load_ckpt", "(", "sess", "=", "None", ",", "mode_name", "=", "'model.ckpt'", ",", "save_dir", "=", "'checkpoint'", ",", "var_list", "=", "None", ",", "is_latest", "=", "True", ",", "printable", "=", "False", ")", ":", "if", "sess", "is", "None", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_npy_to_any
Load `.npy` file. Parameters ------------ path : str Path to the file (optional). name : str File name. Examples --------- - see tl.files.save_any_to_npy()
tensorlayer/files/utils.py
def load_npy_to_any(path='', name='file.npy'): """Load `.npy` file. Parameters ------------ path : str Path to the file (optional). name : str File name. Examples --------- - see tl.files.save_any_to_npy() """ file_path = os.path.join(path, name) try: ...
def load_npy_to_any(path='', name='file.npy'): """Load `.npy` file. Parameters ------------ path : str Path to the file (optional). name : str File name. Examples --------- - see tl.files.save_any_to_npy() """ file_path = os.path.join(path, name) try: ...
[ "Load", ".", "npy", "file", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2093-L2113
[ "def", "load_npy_to_any", "(", "path", "=", "''", ",", "name", "=", "'file.npy'", ")", ":", "file_path", "=", "os", ".", "path", ".", "join", "(", "path", ",", "name", ")", "try", ":", "return", "np", ".", "load", "(", "file_path", ")", ".", "item"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_file_list
r"""Return a file list in a folder by given a path and regular expression. Parameters ---------- path : str or None A folder path, if `None`, use the current directory. regx : str The regx of file name. printable : boolean Whether to print the files infomation. keep_pref...
tensorlayer/files/utils.py
def load_file_list(path=None, regx='\.jpg', printable=True, keep_prefix=False): r"""Return a file list in a folder by given a path and regular expression. Parameters ---------- path : str or None A folder path, if `None`, use the current directory. regx : str The regx of file name. ...
def load_file_list(path=None, regx='\.jpg', printable=True, keep_prefix=False): r"""Return a file list in a folder by given a path and regular expression. Parameters ---------- path : str or None A folder path, if `None`, use the current directory. regx : str The regx of file name. ...
[ "r", "Return", "a", "file", "list", "in", "a", "folder", "by", "given", "a", "path", "and", "regular", "expression", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2148-L2182
[ "def", "load_file_list", "(", "path", "=", "None", ",", "regx", "=", "'\\.jpg'", ",", "printable", "=", "True", ",", "keep_prefix", "=", "False", ")", ":", "if", "path", "is", "None", ":", "path", "=", "os", ".", "getcwd", "(", ")", "file_list", "=",...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
load_folder_list
Return a folder list in a folder by given a folder path. Parameters ---------- path : str A folder path.
tensorlayer/files/utils.py
def load_folder_list(path=""): """Return a folder list in a folder by given a folder path. Parameters ---------- path : str A folder path. """ return [os.path.join(path, o) for o in os.listdir(path) if os.path.isdir(os.path.join(path, o))]
def load_folder_list(path=""): """Return a folder list in a folder by given a folder path. Parameters ---------- path : str A folder path. """ return [os.path.join(path, o) for o in os.listdir(path) if os.path.isdir(os.path.join(path, o))]
[ "Return", "a", "folder", "list", "in", "a", "folder", "by", "given", "a", "folder", "path", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2185-L2194
[ "def", "load_folder_list", "(", "path", "=", "\"\"", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "path", ",", "o", ")", "for", "o", "in", "os", ".", "listdir", "(", "path", ")", "if", "os", ".", "path", ".", "isdir", "(", "os"...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
exists_or_mkdir
Check a folder by given name, if not exist, create the folder and return False, if directory exists, return True. Parameters ---------- path : str A folder path. verbose : boolean If True (default), prints results. Returns -------- boolean True if folder already...
tensorlayer/files/utils.py
def exists_or_mkdir(path, verbose=True): """Check a folder by given name, if not exist, create the folder and return False, if directory exists, return True. Parameters ---------- path : str A folder path. verbose : boolean If True (default), prints results. Returns ---...
def exists_or_mkdir(path, verbose=True): """Check a folder by given name, if not exist, create the folder and return False, if directory exists, return True. Parameters ---------- path : str A folder path. verbose : boolean If True (default), prints results. Returns ---...
[ "Check", "a", "folder", "by", "given", "name", "if", "not", "exist", "create", "the", "folder", "and", "return", "False", "if", "directory", "exists", "return", "True", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2197-L2226
[ "def", "exists_or_mkdir", "(", "path", ",", "verbose", "=", "True", ")", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "if", "verbose", ":", "logging", ".", "info", "(", "\"[*] creates %s ...\"", "%", "path", ")", "os", "...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
maybe_download_and_extract
Checks if file exists in working_directory otherwise tries to dowload the file, and optionally also tries to extract the file if format is ".zip" or ".tar" Parameters ----------- filename : str The name of the (to be) dowloaded file. working_directory : str A folder path to search f...
tensorlayer/files/utils.py
def maybe_download_and_extract(filename, working_directory, url_source, extract=False, expected_bytes=None): """Checks if file exists in working_directory otherwise tries to dowload the file, and optionally also tries to extract the file if format is ".zip" or ".tar" Parameters ----------- filename...
def maybe_download_and_extract(filename, working_directory, url_source, extract=False, expected_bytes=None): """Checks if file exists in working_directory otherwise tries to dowload the file, and optionally also tries to extract the file if format is ".zip" or ".tar" Parameters ----------- filename...
[ "Checks", "if", "file", "exists", "in", "working_directory", "otherwise", "tries", "to", "dowload", "the", "file", "and", "optionally", "also", "tries", "to", "extract", "the", "file", "if", "format", "is", ".", "zip", "or", ".", "tar" ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2229-L2305
[ "def", "maybe_download_and_extract", "(", "filename", ",", "working_directory", ",", "url_source", ",", "extract", "=", "False", ",", "expected_bytes", "=", "None", ")", ":", "# We first define a download function, supporting both Python 2 and 3.", "def", "_download", "(", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
natural_keys
Sort list of string with number in human order. Examples ---------- >>> l = ['im1.jpg', 'im31.jpg', 'im11.jpg', 'im21.jpg', 'im03.jpg', 'im05.jpg'] >>> l.sort(key=tl.files.natural_keys) ['im1.jpg', 'im03.jpg', 'im05', 'im11.jpg', 'im21.jpg', 'im31.jpg'] >>> l.sort() # that is what we dont want ...
tensorlayer/files/utils.py
def natural_keys(text): """Sort list of string with number in human order. Examples ---------- >>> l = ['im1.jpg', 'im31.jpg', 'im11.jpg', 'im21.jpg', 'im03.jpg', 'im05.jpg'] >>> l.sort(key=tl.files.natural_keys) ['im1.jpg', 'im03.jpg', 'im05', 'im11.jpg', 'im21.jpg', 'im31.jpg'] >>> l.sort...
def natural_keys(text): """Sort list of string with number in human order. Examples ---------- >>> l = ['im1.jpg', 'im31.jpg', 'im11.jpg', 'im21.jpg', 'im03.jpg', 'im05.jpg'] >>> l.sort(key=tl.files.natural_keys) ['im1.jpg', 'im03.jpg', 'im05', 'im11.jpg', 'im21.jpg', 'im31.jpg'] >>> l.sort...
[ "Sort", "list", "of", "string", "with", "number", "in", "human", "order", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2308-L2331
[ "def", "natural_keys", "(", "text", ")", ":", "# - alist.sort(key=natural_keys) sorts in human order", "# http://nedbatchelder.com/blog/200712/human_sorting.html", "# (See Toothy's implementation in the comments)", "def", "atoi", "(", "text", ")", ":", "return", "int", "(", "text...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
npz_to_W_pdf
r"""Convert the first weight matrix of `.npz` file to `.pdf` by using `tl.visualize.W()`. Parameters ---------- path : str A folder path to `npz` files. regx : str Regx for the file name. Examples --------- Convert the first weight matrix of w1_pre...npz file to w1_pre...pd...
tensorlayer/files/utils.py
def npz_to_W_pdf(path=None, regx='w1pre_[0-9]+\.(npz)'): r"""Convert the first weight matrix of `.npz` file to `.pdf` by using `tl.visualize.W()`. Parameters ---------- path : str A folder path to `npz` files. regx : str Regx for the file name. Examples --------- Conver...
def npz_to_W_pdf(path=None, regx='w1pre_[0-9]+\.(npz)'): r"""Convert the first weight matrix of `.npz` file to `.pdf` by using `tl.visualize.W()`. Parameters ---------- path : str A folder path to `npz` files. regx : str Regx for the file name. Examples --------- Conver...
[ "r", "Convert", "the", "first", "weight", "matrix", "of", ".", "npz", "file", "to", ".", "pdf", "by", "using", "tl", ".", "visualize", ".", "W", "()", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/files/utils.py#L2335-L2356
[ "def", "npz_to_W_pdf", "(", "path", "=", "None", ",", "regx", "=", "'w1pre_[0-9]+\\.(npz)'", ")", ":", "file_list", "=", "load_file_list", "(", "path", "=", "path", ",", "regx", "=", "regx", ")", "for", "f", "in", "file_list", ":", "W", "=", "load_npz", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
threading_data
Process a batch of data by given function by threading. Usually be used for data augmentation. Parameters ----------- data : numpy.array or others The data to be processed. thread_count : int The number of threads to use. fn : function The function for data processing. ...
tensorlayer/prepro.py
def threading_data(data=None, fn=None, thread_count=None, **kwargs): """Process a batch of data by given function by threading. Usually be used for data augmentation. Parameters ----------- data : numpy.array or others The data to be processed. thread_count : int The number of ...
def threading_data(data=None, fn=None, thread_count=None, **kwargs): """Process a batch of data by given function by threading. Usually be used for data augmentation. Parameters ----------- data : numpy.array or others The data to be processed. thread_count : int The number of ...
[ "Process", "a", "batch", "of", "data", "by", "given", "function", "by", "threading", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L124-L234
[ "def", "threading_data", "(", "data", "=", "None", ",", "fn", "=", "None", ",", "thread_count", "=", "None", ",", "*", "*", "kwargs", ")", ":", "def", "apply_fn", "(", "results", ",", "i", ",", "data", ",", "kwargs", ")", ":", "results", "[", "i", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_rotation_matrix
Create an affine transform matrix for image rotation. NOTE: In OpenCV, x is width and y is height. Parameters ----------- angle : int/float or tuple of two int/float Degree to rotate, usually -180 ~ 180. - int/float, a fixed angle. - tuple of 2 floats/ints, randomly samp...
tensorlayer/prepro.py
def affine_rotation_matrix(angle=(-20, 20)): """Create an affine transform matrix for image rotation. NOTE: In OpenCV, x is width and y is height. Parameters ----------- angle : int/float or tuple of two int/float Degree to rotate, usually -180 ~ 180. - int/float, a fixed angle....
def affine_rotation_matrix(angle=(-20, 20)): """Create an affine transform matrix for image rotation. NOTE: In OpenCV, x is width and y is height. Parameters ----------- angle : int/float or tuple of two int/float Degree to rotate, usually -180 ~ 180. - int/float, a fixed angle....
[ "Create", "an", "affine", "transform", "matrix", "for", "image", "rotation", ".", "NOTE", ":", "In", "OpenCV", "x", "is", "width", "and", "y", "is", "height", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L237-L261
[ "def", "affine_rotation_matrix", "(", "angle", "=", "(", "-", "20", ",", "20", ")", ")", ":", "if", "isinstance", "(", "angle", ",", "tuple", ")", ":", "theta", "=", "np", ".", "pi", "/", "180", "*", "np", ".", "random", ".", "uniform", "(", "ang...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_horizontal_flip_matrix
Create an affine transformation matrix for image horizontal flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.array An affine transform matrix.
tensorlayer/prepro.py
def affine_horizontal_flip_matrix(prob=0.5): """Create an affine transformation matrix for image horizontal flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.arra...
def affine_horizontal_flip_matrix(prob=0.5): """Create an affine transformation matrix for image horizontal flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.arra...
[ "Create", "an", "affine", "transformation", "matrix", "for", "image", "horizontal", "flipping", ".", "NOTE", ":", "In", "OpenCV", "x", "is", "width", "and", "y", "is", "height", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L264-L289
[ "def", "affine_horizontal_flip_matrix", "(", "prob", "=", "0.5", ")", ":", "factor", "=", "np", ".", "random", ".", "uniform", "(", "0", ",", "1", ")", "if", "prob", ">=", "factor", ":", "filp_matrix", "=", "np", ".", "array", "(", "[", "[", "-", "...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_vertical_flip_matrix
Create an affine transformation for image vertical flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.array An affine transform matrix.
tensorlayer/prepro.py
def affine_vertical_flip_matrix(prob=0.5): """Create an affine transformation for image vertical flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.array A...
def affine_vertical_flip_matrix(prob=0.5): """Create an affine transformation for image vertical flipping. NOTE: In OpenCV, x is width and y is height. Parameters ---------- prob : float Probability to flip the image. 1.0 means always flip. Returns ------- numpy.array A...
[ "Create", "an", "affine", "transformation", "for", "image", "vertical", "flipping", ".", "NOTE", ":", "In", "OpenCV", "x", "is", "width", "and", "y", "is", "height", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L292-L317
[ "def", "affine_vertical_flip_matrix", "(", "prob", "=", "0.5", ")", ":", "factor", "=", "np", ".", "random", ".", "uniform", "(", "0", ",", "1", ")", "if", "prob", ">=", "factor", ":", "filp_matrix", "=", "np", ".", "array", "(", "[", "[", "1.", ",...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_shift_matrix
Create an affine transform matrix for image shifting. NOTE: In OpenCV, x is width and y is height. Parameters ----------- wrg : float or tuple of floats Range to shift on width axis, -1 ~ 1. - float, a fixed distance. - tuple of 2 floats, randomly sample a value as the d...
tensorlayer/prepro.py
def affine_shift_matrix(wrg=(-0.1, 0.1), hrg=(-0.1, 0.1), w=200, h=200): """Create an affine transform matrix for image shifting. NOTE: In OpenCV, x is width and y is height. Parameters ----------- wrg : float or tuple of floats Range to shift on width axis, -1 ~ 1. - float, a f...
def affine_shift_matrix(wrg=(-0.1, 0.1), hrg=(-0.1, 0.1), w=200, h=200): """Create an affine transform matrix for image shifting. NOTE: In OpenCV, x is width and y is height. Parameters ----------- wrg : float or tuple of floats Range to shift on width axis, -1 ~ 1. - float, a f...
[ "Create", "an", "affine", "transform", "matrix", "for", "image", "shifting", ".", "NOTE", ":", "In", "OpenCV", "x", "is", "width", "and", "y", "is", "height", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L320-L354
[ "def", "affine_shift_matrix", "(", "wrg", "=", "(", "-", "0.1", ",", "0.1", ")", ",", "hrg", "=", "(", "-", "0.1", ",", "0.1", ")", ",", "w", "=", "200", ",", "h", "=", "200", ")", ":", "if", "isinstance", "(", "wrg", ",", "tuple", ")", ":", ...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_shear_matrix
Create affine transform matrix for image shearing. NOTE: In OpenCV, x is width and y is height. Parameters ----------- shear : tuple of two floats Percentage of shears for width and height directions. Returns ------- numpy.array An affine transform matrix.
tensorlayer/prepro.py
def affine_shear_matrix(x_shear=(-0.1, 0.1), y_shear=(-0.1, 0.1)): """Create affine transform matrix for image shearing. NOTE: In OpenCV, x is width and y is height. Parameters ----------- shear : tuple of two floats Percentage of shears for width and height directions. Returns ---...
def affine_shear_matrix(x_shear=(-0.1, 0.1), y_shear=(-0.1, 0.1)): """Create affine transform matrix for image shearing. NOTE: In OpenCV, x is width and y is height. Parameters ----------- shear : tuple of two floats Percentage of shears for width and height directions. Returns ---...
[ "Create", "affine", "transform", "matrix", "for", "image", "shearing", ".", "NOTE", ":", "In", "OpenCV", "x", "is", "width", "and", "y", "is", "height", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L357-L389
[ "def", "affine_shear_matrix", "(", "x_shear", "=", "(", "-", "0.1", ",", "0.1", ")", ",", "y_shear", "=", "(", "-", "0.1", ",", "0.1", ")", ")", ":", "# if len(shear) != 2:", "# raise AssertionError(", "# \"shear should be tuple of 2 floats, or you want to...
aa9e52e36c7058a7e6fd81d36563ca6850b21956
valid
affine_zoom_matrix
Create an affine transform matrix for zooming/scaling an image's height and width. OpenCV format, x is width. Parameters ----------- x : numpy.array An image with dimension of [row, col, channel] (default). zoom_range : float or tuple of 2 floats The zooming/scaling ratio, greater t...
tensorlayer/prepro.py
def affine_zoom_matrix(zoom_range=(0.8, 1.1)): """Create an affine transform matrix for zooming/scaling an image's height and width. OpenCV format, x is width. Parameters ----------- x : numpy.array An image with dimension of [row, col, channel] (default). zoom_range : float or tuple of...
def affine_zoom_matrix(zoom_range=(0.8, 1.1)): """Create an affine transform matrix for zooming/scaling an image's height and width. OpenCV format, x is width. Parameters ----------- x : numpy.array An image with dimension of [row, col, channel] (default). zoom_range : float or tuple of...
[ "Create", "an", "affine", "transform", "matrix", "for", "zooming", "/", "scaling", "an", "image", "s", "height", "and", "width", ".", "OpenCV", "format", "x", "is", "width", "." ]
tensorlayer/tensorlayer
python
https://github.com/tensorlayer/tensorlayer/blob/aa9e52e36c7058a7e6fd81d36563ca6850b21956/tensorlayer/prepro.py#L392-L422
[ "def", "affine_zoom_matrix", "(", "zoom_range", "=", "(", "0.8", ",", "1.1", ")", ")", ":", "if", "isinstance", "(", "zoom_range", ",", "(", "float", ",", "int", ")", ")", ":", "scale", "=", "zoom_range", "elif", "isinstance", "(", "zoom_range", ",", "...
aa9e52e36c7058a7e6fd81d36563ca6850b21956