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
train
save_json_dict
Will error if filename is not appropriate, but it's checked elsewhere.
cufflinks/auth.py
def save_json_dict(filename, json_dict): """Will error if filename is not appropriate, but it's checked elsewhere. """ if isinstance(json_dict, dict): with open(filename, "w") as f: f.write(json.dumps(json_dict, indent=4)) else: raise TypeError("json_dict was not a dictionay. couldn't save.")
def save_json_dict(filename, json_dict): """Will error if filename is not appropriate, but it's checked elsewhere. """ if isinstance(json_dict, dict): with open(filename, "w") as f: f.write(json.dumps(json_dict, indent=4)) else: raise TypeError("json_dict was not a dictionay. couldn't save.")
[ "Will", "error", "if", "filename", "is", "not", "appropriate", "but", "it", "s", "checked", "elsewhere", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/auth.py#L209-L216
[ "def", "save_json_dict", "(", "filename", ",", "json_dict", ")", ":", "if", "isinstance", "(", "json_dict", ",", "dict", ")", ":", "with", "open", "(", "filename", ",", "\"w\"", ")", "as", "f", ":", "f", ".", "write", "(", "json", ".", "dumps", "(", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._get_schema
Returns a dictionary with the schema for a QuantFigure
cufflinks/quant_figure.py
def _get_schema(self): """ Returns a dictionary with the schema for a QuantFigure """ d={} layout_kwargs=dict((_,'') for _ in get_layout_kwargs()) for _ in ('data','layout','theme','panels'): d[_]={} for __ in eval('__QUANT_FIGURE_{0}'.format(_.upper())): layout_kwargs.pop(__,None) d[_][__]=N...
def _get_schema(self): """ Returns a dictionary with the schema for a QuantFigure """ d={} layout_kwargs=dict((_,'') for _ in get_layout_kwargs()) for _ in ('data','layout','theme','panels'): d[_]={} for __ in eval('__QUANT_FIGURE_{0}'.format(_.upper())): layout_kwargs.pop(__,None) d[_][__]=N...
[ "Returns", "a", "dictionary", "with", "the", "schema", "for", "a", "QuantFigure" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L107-L124
[ "def", "_get_schema", "(", "self", ")", ":", "d", "=", "{", "}", "layout_kwargs", "=", "dict", "(", "(", "_", ",", "''", ")", "for", "_", "in", "get_layout_kwargs", "(", ")", ")", "for", "_", "in", "(", "'data'", ",", "'layout'", ",", "'theme'", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._get_sliced
Returns a sliced DataFrame Parameters ---------- slice : tuple(from,to) from : str to : str States the 'from' and 'to' values which will get rendered as df.ix[from:to] df : DataFrame If omitted then the QuantFigure.DataFrame is resampled.
cufflinks/quant_figure.py
def _get_sliced(self,slice,df=None): """ Returns a sliced DataFrame Parameters ---------- slice : tuple(from,to) from : str to : str States the 'from' and 'to' values which will get rendered as df.ix[from:to] df : DataFrame If omitted then the QuantFigure.DataFrame is resampled. ...
def _get_sliced(self,slice,df=None): """ Returns a sliced DataFrame Parameters ---------- slice : tuple(from,to) from : str to : str States the 'from' and 'to' values which will get rendered as df.ix[from:to] df : DataFrame If omitted then the QuantFigure.DataFrame is resampled. ...
[ "Returns", "a", "sliced", "DataFrame" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L126-L149
[ "def", "_get_sliced", "(", "self", ",", "slice", ",", "df", "=", "None", ")", ":", "df", "=", "self", ".", "df", ".", "copy", "(", ")", "if", "df", "==", "None", "else", "df", "if", "type", "(", "slice", ")", "not", "in", "(", "list", ",", "t...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._get_resampled
Returns a resampled DataFrame Parameters ---------- rule : str the offset string or object representing target conversion for all aliases available see http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases how : str or dict states the form in which the resampling will be done...
cufflinks/quant_figure.py
def _get_resampled(self,rule,how={'ohlc':'last','volume':'sum'},df=None,**kwargs): """ Returns a resampled DataFrame Parameters ---------- rule : str the offset string or object representing target conversion for all aliases available see http://pandas.pydata.org/pandas-docs/stable/timeseries.html#o...
def _get_resampled(self,rule,how={'ohlc':'last','volume':'sum'},df=None,**kwargs): """ Returns a resampled DataFrame Parameters ---------- rule : str the offset string or object representing target conversion for all aliases available see http://pandas.pydata.org/pandas-docs/stable/timeseries.html#o...
[ "Returns", "a", "resampled", "DataFrame" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L151-L184
[ "def", "_get_resampled", "(", "self", ",", "rule", ",", "how", "=", "{", "'ohlc'", ":", "'last'", ",", "'volume'", ":", "'sum'", "}", ",", "df", "=", "None", ",", "*", "*", "kwargs", ")", ":", "df", "=", "self", ".", "df", ".", "copy", "(", ")"...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.update
Updates the values for a QuantFigure The key-values are automatically assigned to the correct section of the QuantFigure
cufflinks/quant_figure.py
def update(self,**kwargs): """ Updates the values for a QuantFigure The key-values are automatically assigned to the correct section of the QuantFigure """ if 'columns' in kwargs: self._d=ta._ohlc_dict(self.df,columns=kwargs.pop('columns',None)) schema=self._get_schema() annotations=kwargs.pop('anno...
def update(self,**kwargs): """ Updates the values for a QuantFigure The key-values are automatically assigned to the correct section of the QuantFigure """ if 'columns' in kwargs: self._d=ta._ohlc_dict(self.df,columns=kwargs.pop('columns',None)) schema=self._get_schema() annotations=kwargs.pop('anno...
[ "Updates", "the", "values", "for", "a", "QuantFigure", "The", "key", "-", "values", "are", "automatically", "assigned", "to", "the", "correct", "section", "of", "the", "QuantFigure" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L186-L203
[ "def", "update", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "'columns'", "in", "kwargs", ":", "self", ".", "_d", "=", "ta", ".", "_ohlc_dict", "(", "self", ".", "df", ",", "columns", "=", "kwargs", ".", "pop", "(", "'columns'", ",", "N...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.delete
Deletes the values for a QuantFigure The key-values are automatically deleted from the correct section of the QuantFigure
cufflinks/quant_figure.py
def delete(self,*args): """ Deletes the values for a QuantFigure The key-values are automatically deleted from the correct section of the QuantFigure """ if args: args=args[0] if utils.is_list(args[0]) else args path=utils.dict_path(self.__dict__) for _ in args: if _ in self.__dict__.keys(): ...
def delete(self,*args): """ Deletes the values for a QuantFigure The key-values are automatically deleted from the correct section of the QuantFigure """ if args: args=args[0] if utils.is_list(args[0]) else args path=utils.dict_path(self.__dict__) for _ in args: if _ in self.__dict__.keys(): ...
[ "Deletes", "the", "values", "for", "a", "QuantFigure", "The", "key", "-", "values", "are", "automatically", "deleted", "from", "the", "correct", "section", "of", "the", "QuantFigure" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L205-L227
[ "def", "delete", "(", "self", ",", "*", "args", ")", ":", "if", "args", ":", "args", "=", "args", "[", "0", "]", "if", "utils", ".", "is_list", "(", "args", "[", "0", "]", ")", "else", "args", "path", "=", "utils", ".", "dict_path", "(", "self"...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._panel_domains
Returns the panel domains for each axis
cufflinks/quant_figure.py
def _panel_domains(self,n=2,min_panel_size=.15,spacing=0.08,top_margin=1,bottom_margin=0): """ Returns the panel domains for each axis """ d={} for _ in range(n+1,1,-1): lower=round(bottom_margin+(min_panel_size+spacing)*(n+1-_),2) d['yaxis{0}'.format(_)]=dict(domain=(lower,lower+min_panel_size)) ...
def _panel_domains(self,n=2,min_panel_size=.15,spacing=0.08,top_margin=1,bottom_margin=0): """ Returns the panel domains for each axis """ d={} for _ in range(n+1,1,-1): lower=round(bottom_margin+(min_panel_size+spacing)*(n+1-_),2) d['yaxis{0}'.format(_)]=dict(domain=(lower,lower+min_panel_size)) ...
[ "Returns", "the", "panel", "domains", "for", "each", "axis" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L239-L251
[ "def", "_panel_domains", "(", "self", ",", "n", "=", "2", ",", "min_panel_size", "=", ".15", ",", "spacing", "=", "0.08", ",", "top_margin", "=", "1", ",", "bottom_margin", "=", "0", ")", ":", "d", "=", "{", "}", "for", "_", "in", "range", "(", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._get_trendline
Returns a trendline (line), support or resistance Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data series in which the trendline should be based. 'close' 'high' 'low' 'open' kind : string Def...
cufflinks/quant_figure.py
def _get_trendline(self,date0=None,date1=None,on=None,kind='trend',to_strfmt='%Y-%m-%d',from_strfmt='%d%b%y',**kwargs): """ Returns a trendline (line), support or resistance Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data...
def _get_trendline(self,date0=None,date1=None,on=None,kind='trend',to_strfmt='%Y-%m-%d',from_strfmt='%d%b%y',**kwargs): """ Returns a trendline (line), support or resistance Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data...
[ "Returns", "a", "trendline", "(", "line", ")", "support", "or", "resistance" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L253-L340
[ "def", "_get_trendline", "(", "self", ",", "date0", "=", "None", ",", "date1", "=", "None", ",", "on", "=", "None", ",", "kind", "=", "'trend'", ",", "to_strfmt", "=", "'%Y-%m-%d'", ",", "from_strfmt", "=", "'%d%b%y'", ",", "*", "*", "kwargs", ")", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_trendline
Adds a trendline to the QuantFigure. Given 2 dates, the trendline is connected on the data points that correspond to those dates. Parameters: date0 : string Trendline starting date date1 : string Trendline end date on : string Indicate the data series in which the trendline should be...
cufflinks/quant_figure.py
def add_trendline(self,date0,date1,on='close',text=None,**kwargs): """ Adds a trendline to the QuantFigure. Given 2 dates, the trendline is connected on the data points that correspond to those dates. Parameters: date0 : string Trendline starting date date1 : string Trendline end date on ...
def add_trendline(self,date0,date1,on='close',text=None,**kwargs): """ Adds a trendline to the QuantFigure. Given 2 dates, the trendline is connected on the data points that correspond to those dates. Parameters: date0 : string Trendline starting date date1 : string Trendline end date on ...
[ "Adds", "a", "trendline", "to", "the", "QuantFigure", ".", "Given", "2", "dates", "the", "trendline", "is", "connected", "on", "the", "data", "points", "that", "correspond", "to", "those", "dates", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L342-L377
[ "def", "add_trendline", "(", "self", ",", "date0", ",", "date1", ",", "on", "=", "'close'", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "'kind'", ":", "'trend'", ",", "'date0'", ":", "date0", ",", "'date1'", ":", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_support
Adds a support line to the QuantFigure Parameters: date0 : string The support line will be drawn at the 'y' level value that corresponds to this date. on : string Indicate the data series in which the support line should be based. 'close' 'high' 'low' 'open' mode : str...
cufflinks/quant_figure.py
def add_support(self,date,on='low',mode='starttoend',text=None,**kwargs): """ Adds a support line to the QuantFigure Parameters: date0 : string The support line will be drawn at the 'y' level value that corresponds to this date. on : string Indicate the data series in which the support l...
def add_support(self,date,on='low',mode='starttoend',text=None,**kwargs): """ Adds a support line to the QuantFigure Parameters: date0 : string The support line will be drawn at the 'y' level value that corresponds to this date. on : string Indicate the data series in which the support l...
[ "Adds", "a", "support", "line", "to", "the", "QuantFigure" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L379-L417
[ "def", "add_support", "(", "self", ",", "date", ",", "on", "=", "'low'", ",", "mode", "=", "'starttoend'", ",", "text", "=", "None", ",", "*", "*", "kwargs", ")", ":", "d", "=", "{", "'kind'", ":", "'support'", ",", "'date'", ":", "date", ",", "'...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_annotations
Add an annotation to the QuantFigure. Parameters: annotations : dict or list(dict,) Annotations can be on the form form of {'date' : 'text'} and the text will automatically be placed at the right level on the chart or A Plotly fully defined annotation kwargs : fontcolor : st...
cufflinks/quant_figure.py
def add_annotations(self,annotations,**kwargs): """ Add an annotation to the QuantFigure. Parameters: annotations : dict or list(dict,) Annotations can be on the form form of {'date' : 'text'} and the text will automatically be placed at the right level on the chart or A Plotly...
def add_annotations(self,annotations,**kwargs): """ Add an annotation to the QuantFigure. Parameters: annotations : dict or list(dict,) Annotations can be on the form form of {'date' : 'text'} and the text will automatically be placed at the right level on the chart or A Plotly...
[ "Add", "an", "annotation", "to", "the", "QuantFigure", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L459-L489
[ "def", "add_annotations", "(", "self", ",", "annotations", ",", "*", "*", "kwargs", ")", ":", "ann_kwargs", "=", "utils", ".", "check_kwargs", "(", "kwargs", ",", "get_annotation_kwargs", "(", ")", ",", "{", "}", ",", "clean_origin", "=", "True", ")", "i...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_shapes
Add a shape to the QuantFigure. kwargs : hline : int, list or dict Draws a horizontal line at the indicated y position(s) Extra parameters can be passed in the form of a dictionary (see shapes) vline : int, list or dict Draws a vertical line at the indicated x position(s) Extra pa...
cufflinks/quant_figure.py
def add_shapes(self,**kwargs): """ Add a shape to the QuantFigure. kwargs : hline : int, list or dict Draws a horizontal line at the indicated y position(s) Extra parameters can be passed in the form of a dictionary (see shapes) vline : int, list or dict Draws a vertical line at the ...
def add_shapes(self,**kwargs): """ Add a shape to the QuantFigure. kwargs : hline : int, list or dict Draws a horizontal line at the indicated y position(s) Extra parameters can be passed in the form of a dictionary (see shapes) vline : int, list or dict Draws a vertical line at the ...
[ "Add", "a", "shape", "to", "the", "QuantFigure", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L491-L531
[ "def", "add_shapes", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "utils", ".", "check_kwargs", "(", "kwargs", ",", "get_shapes_kwargs", "(", ")", ",", "{", "}", ",", "clean_origin", "=", "True", ")", "for", "k", ",", "v", "in", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig._add_study
Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, 'display':display_parameters}
cufflinks/quant_figure.py
def _add_study(self,study): """ Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, 'display':display_parameters} """ str='{study} {name}({period})' if study['params'].get('str',None)==None else study['params']['str'] study['params'][...
def _add_study(self,study): """ Adds a study to QuantFigure.studies Parameters: study : dict {'kind':study_kind, 'params':study_parameters, 'display':display_parameters} """ str='{study} {name}({period})' if study['params'].get('str',None)==None else study['params']['str'] study['params'][...
[ "Adds", "a", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L542-L580
[ "def", "_add_study", "(", "self", ",", "study", ")", ":", "str", "=", "'{study} {name}({period})'", "if", "study", "[", "'params'", "]", ".", "get", "(", "'str'", ",", "None", ")", "==", "None", "else", "study", "[", "'params'", "]", "[", "'str'", "]",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_volume
Add 'volume' study to QuantFigure.studies Parameters: colorchange : bool If True then each volume bar will have a fill color depending on if 'base' had a positive or negative change compared to the previous value If False then each volume bar will have a fill color depending on if the volume...
cufflinks/quant_figure.py
def add_volume(self,colorchange=True,column=None,name='',str='{name}',**kwargs): """ Add 'volume' study to QuantFigure.studies Parameters: colorchange : bool If True then each volume bar will have a fill color depending on if 'base' had a positive or negative change compared to the previous value...
def add_volume(self,colorchange=True,column=None,name='',str='{name}',**kwargs): """ Add 'volume' study to QuantFigure.studies Parameters: colorchange : bool If True then each volume bar will have a fill color depending on if 'base' had a positive or negative change compared to the previous value...
[ "Add", "volume", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L582-L627
[ "def", "add_volume", "(", "self", ",", "colorchange", "=", "True", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "'{name}'", ",", "*", "*", "kwargs", ")", ":", "if", "not", "column", ":", "column", "=", "self", ".", "_d", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_macd
Add Moving Average Convergence Divergence (MACD) study to QuantFigure.studies Parameters: fast_period : int MACD Fast Period slow_period : int MACD Slow Period signal_period : int MACD Signal Period column :string Defines the data column name that contains the data over which the stu...
cufflinks/quant_figure.py
def add_macd(self,fast_period=12,slow_period=26,signal_period=9,column=None, name='',str=None,**kwargs): """ Add Moving Average Convergence Divergence (MACD) study to QuantFigure.studies Parameters: fast_period : int MACD Fast Period slow_period : int MACD Slow Period signal_period : int ...
def add_macd(self,fast_period=12,slow_period=26,signal_period=9,column=None, name='',str=None,**kwargs): """ Add Moving Average Convergence Divergence (MACD) study to QuantFigure.studies Parameters: fast_period : int MACD Fast Period slow_period : int MACD Slow Period signal_period : int ...
[ "Add", "Moving", "Average", "Convergence", "Divergence", "(", "MACD", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L629-L671
[ "def", "add_macd", "(", "self", ",", "fast_period", "=", "12", ",", "slow_period", "=", "26", ",", "signal_period", "=", "9", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "n...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_sma
Add Simple Moving Average (SMA) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods column :string Defines the data column name that contains the data over which the study will be applied. Default: 'close' name : string Name given to the study str :...
cufflinks/quant_figure.py
def add_sma(self,periods=20,column=None,name='', str=None,**kwargs): """ Add Simple Moving Average (SMA) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods column :string Defines the data column name that contains the data over which the study will be ap...
def add_sma(self,periods=20,column=None,name='', str=None,**kwargs): """ Add Simple Moving Average (SMA) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods column :string Defines the data column name that contains the data over which the study will be ap...
[ "Add", "Simple", "Moving", "Average", "(", "SMA", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L674-L709
[ "def", "add_sma", "(", "self", ",", "periods", "=", "20", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "column", ":", "column", "=", "self", ".", "_d", "[", "'close...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_rsi
Add Relative Strength Indicator (RSI) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods rsi_upper : int bounds [0,100] Upper (overbought) level rsi_lower : int bounds [0,100] Lower (oversold) level showbands : boolean If True, then the rsi_uppe...
cufflinks/quant_figure.py
def add_rsi(self,periods=20,rsi_upper=70,rsi_lower=30,showbands=True,column=None, name='',str=None,**kwargs): """ Add Relative Strength Indicator (RSI) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods rsi_upper : int bounds [0,100] Upper (overbough...
def add_rsi(self,periods=20,rsi_upper=70,rsi_lower=30,showbands=True,column=None, name='',str=None,**kwargs): """ Add Relative Strength Indicator (RSI) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods rsi_upper : int bounds [0,100] Upper (overbough...
[ "Add", "Relative", "Strength", "Indicator", "(", "RSI", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L711-L758
[ "def", "add_rsi", "(", "self", ",", "periods", "=", "20", ",", "rsi_upper", "=", "70", ",", "rsi_lower", "=", "30", ",", "showbands", "=", "True", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "None", ",", "*", "*", "kwargs...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_bollinger_bands
Add Bollinger Bands (BOLL) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods boll_std : int Number of standard deviations for the bollinger upper and lower bands fill : boolean If True, then the innner area of the bands will filled column :string ...
cufflinks/quant_figure.py
def add_bollinger_bands(self,periods=20,boll_std=2,fill=True,column=None,name='', str='{name}({column},{period})',**kwargs): """ Add Bollinger Bands (BOLL) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods boll_std : int Number of standard deviations for...
def add_bollinger_bands(self,periods=20,boll_std=2,fill=True,column=None,name='', str='{name}({column},{period})',**kwargs): """ Add Bollinger Bands (BOLL) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods boll_std : int Number of standard deviations for...
[ "Add", "Bollinger", "Bands", "(", "BOLL", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L760-L805
[ "def", "add_bollinger_bands", "(", "self", ",", "periods", "=", "20", ",", "boll_std", "=", "2", ",", "fill", "=", "True", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "'{name}({column},{period})'", ",", "*", "*", "kwargs", ")",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_cci
Commodity Channel Indicator study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods cci_upper : int Upper bands level default : 100 cci_lower : int Lower band level default : -100 showbands : boolean If True, then the cci_upper and cci_lower level...
cufflinks/quant_figure.py
def add_cci(self,periods=14,cci_upper=100,cci_lower=-100, showbands=True,str=None,name='',**kwargs): """ Commodity Channel Indicator study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods cci_upper : int Upper bands level default : 100 cci_lower : int ...
def add_cci(self,periods=14,cci_upper=100,cci_lower=-100, showbands=True,str=None,name='',**kwargs): """ Commodity Channel Indicator study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods cci_upper : int Upper bands level default : 100 cci_lower : int ...
[ "Commodity", "Channel", "Indicator", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L844-L883
[ "def", "add_cci", "(", "self", ",", "periods", "=", "14", ",", "cci_upper", "=", "100", ",", "cci_lower", "=", "-", "100", ",", "showbands", "=", "True", ",", "str", "=", "None", ",", "name", "=", "''", ",", "*", "*", "kwargs", ")", ":", "study",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_ptps
Add Parabolic SAR (PTPS) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods af : float acceleration factor initial : 'long' or 'short' Iniital position default: long name : string Name given to the study str : string Label factory for studies ...
cufflinks/quant_figure.py
def add_ptps(self,periods=14,af=0.2,initial='long',str=None,name='',**kwargs): """ Add Parabolic SAR (PTPS) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods af : float acceleration factor initial : 'long' or 'short' Iniital position default: long n...
def add_ptps(self,periods=14,af=0.2,initial='long',str=None,name='',**kwargs): """ Add Parabolic SAR (PTPS) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods af : float acceleration factor initial : 'long' or 'short' Iniital position default: long n...
[ "Add", "Parabolic", "SAR", "(", "PTPS", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L915-L948
[ "def", "add_ptps", "(", "self", ",", "periods", "=", "14", ",", "af", "=", "0.2", ",", "initial", "=", "'long'", ",", "str", "=", "None", ",", "name", "=", "''", ",", "*", "*", "kwargs", ")", ":", "study", "=", "{", "'kind'", ":", "'ptps'", ","...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
QuantFig.add_atr
Add Average True Range (ATR) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods name : string Name given to the study str : string Label factory for studies The following wildcards can be used: {name} : Name of the column {study} : Name of the stu...
cufflinks/quant_figure.py
def add_atr(self,periods=14,str=None,name='',**kwargs): """ Add Average True Range (ATR) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods name : string Name given to the study str : string Label factory for studies The following wildcards can be used:...
def add_atr(self,periods=14,str=None,name='',**kwargs): """ Add Average True Range (ATR) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods name : string Name given to the study str : string Label factory for studies The following wildcards can be used:...
[ "Add", "Average", "True", "Range", "(", "ATR", ")", "study", "to", "QuantFigure", ".", "studies" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/quant_figure.py#L950-L978
[ "def", "add_atr", "(", "self", ",", "periods", "=", "14", ",", "str", "=", "None", ",", "name", "=", "''", ",", "*", "*", "kwargs", ")", ":", "study", "=", "{", "'kind'", ":", "'atr'", ",", "'name'", ":", "name", ",", "'params'", ":", "{", "'pe...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
go_offline
connected : bool If True, the plotly.js library will be loaded from an online CDN. If False, the plotly.js library will be loaded locally from the plotly python package
cufflinks/offline.py
def go_offline(connected=None): """ connected : bool If True, the plotly.js library will be loaded from an online CDN. If False, the plotly.js library will be loaded locally from the plotly python package """ from .auth import get_config_file if connected is None: try...
def go_offline(connected=None): """ connected : bool If True, the plotly.js library will be loaded from an online CDN. If False, the plotly.js library will be loaded locally from the plotly python package """ from .auth import get_config_file if connected is None: try...
[ "connected", ":", "bool", "If", "True", "the", "plotly", ".", "js", "library", "will", "be", "loaded", "from", "an", "online", "CDN", ".", "If", "False", "the", "plotly", ".", "js", "library", "will", "be", "loaded", "locally", "from", "the", "plotly", ...
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/offline.py#L13-L32
[ "def", "go_offline", "(", "connected", "=", "None", ")", ":", "from", ".", "auth", "import", "get_config_file", "if", "connected", "is", "None", ":", "try", ":", "connected", "=", "True", "if", "get_config_file", "(", ")", "[", "'offline_connected'", "]", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
_screen
Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate the column and value to screen for Examp...
cufflinks/pandastools.py
def _screen(self,include=True,**kwargs): """ Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate...
def _screen(self,include=True,**kwargs): """ Filters a DataFrame for columns that contain the given strings. Parameters: ----------- include : bool If False then it will exclude items that match the given filters. This is the same as passing a regex ^keyword kwargs : Key value pairs that indicate...
[ "Filters", "a", "DataFrame", "for", "columns", "that", "contain", "the", "given", "strings", ".", "Parameters", ":", "-----------", "include", ":", "bool", "If", "False", "then", "it", "will", "exclude", "items", "that", "match", "the", "given", "filters", "...
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/pandastools.py#L6-L29
[ "def", "_screen", "(", "self", ",", "include", "=", "True", ",", "*", "*", "kwargs", ")", ":", "df", "=", "self", ".", "copy", "(", ")", "for", "k", ",", "v", "in", "list", "(", "kwargs", ".", "items", "(", ")", ")", ":", "v", "=", "[", "v"...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
bestfit
Returns a series with the bestfit values. Example: Series.bestfit() Returns: series The returned series contains a parameter called 'formula' which includes the string representation of the bestfit line.
cufflinks/pandastools.py
def bestfit(self): """ Returns a series with the bestfit values. Example: Series.bestfit() Returns: series The returned series contains a parameter called 'formula' which includes the string representation of the bestfit line. """ # statsmodel cannot be included on requirements.txt # see https://g...
def bestfit(self): """ Returns a series with the bestfit values. Example: Series.bestfit() Returns: series The returned series contains a parameter called 'formula' which includes the string representation of the bestfit line. """ # statsmodel cannot be included on requirements.txt # see https://g...
[ "Returns", "a", "series", "with", "the", "bestfit", "values", ".", "Example", ":", "Series", ".", "bestfit", "()" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/pandastools.py#L44-L76
[ "def", "bestfit", "(", "self", ")", ":", "# statsmodel cannot be included on requirements.txt", "# see https://github.com/scikit-learn/scikit-learn/issues/4164", "# which shares the same issue as statsmodel", "try", ":", "import", "statsmodels", ".", "api", "as", "sm", "except", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
normalize
Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted
cufflinks/pandastools.py
def normalize(self,asOf=None,multiplier=100): """ Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted """ if not asOf: ...
def normalize(self,asOf=None,multiplier=100): """ Returns a normalized series or DataFrame Example: Series.normalize() Returns: series of DataFrame Parameters: ----------- asOf : string Date format '2015-02-29' multiplier : int Factor by which the results will be adjusted """ if not asOf: ...
[ "Returns", "a", "normalized", "series", "or", "DataFrame", "Example", ":", "Series", ".", "normalize", "()" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/pandastools.py#L78-L99
[ "def", "normalize", "(", "self", ",", "asOf", "=", "None", ",", "multiplier", "=", "100", ")", ":", "if", "not", "asOf", ":", "x0", "=", "self", ".", "ix", "[", "0", "]", "else", ":", "x0", "=", "self", ".", "ix", "[", "asOf", "]", "return", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
merge_dict
d1 <-- d2
cufflinks/utils.py
def merge_dict(d1,d2): """ d1 <-- d2 """ d=copy.deepcopy(d2) for k,v in list(d1.items()): if k not in d: d[k]=v else: if isinstance(v,dict): d[k]=merge_dict(d1[k],d[k]) return d
def merge_dict(d1,d2): """ d1 <-- d2 """ d=copy.deepcopy(d2) for k,v in list(d1.items()): if k not in d: d[k]=v else: if isinstance(v,dict): d[k]=merge_dict(d1[k],d[k]) return d
[ "d1", "<", "--", "d2" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L24-L35
[ "def", "merge_dict", "(", "d1", ",", "d2", ")", ":", "d", "=", "copy", ".", "deepcopy", "(", "d2", ")", "for", "k", ",", "v", "in", "list", "(", "d1", ".", "items", "(", ")", ")", ":", "if", "k", "not", "in", "d", ":", "d", "[", "k", "]",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
dict_path
Returns a dictionary with the path in which each of the keys is found Parameters: from_d : dict Dictionary that contains all the keys, values to_d : dict Dictionary to which the results will be appended Example: dict_path({'level1':{'level2':{'level3':'value'}}}) Returns {'level1': [], 'level...
cufflinks/utils.py
def dict_path(from_d,to_d={},l=[]): """ Returns a dictionary with the path in which each of the keys is found Parameters: from_d : dict Dictionary that contains all the keys, values to_d : dict Dictionary to which the results will be appended Example: dict_path({'level1':{'level2':{'level3':'value'}}...
def dict_path(from_d,to_d={},l=[]): """ Returns a dictionary with the path in which each of the keys is found Parameters: from_d : dict Dictionary that contains all the keys, values to_d : dict Dictionary to which the results will be appended Example: dict_path({'level1':{'level2':{'level3':'value'}}...
[ "Returns", "a", "dictionary", "with", "the", "path", "in", "which", "each", "of", "the", "keys", "is", "found" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L37-L65
[ "def", "dict_path", "(", "from_d", ",", "to_d", "=", "{", "}", ",", "l", "=", "[", "]", ")", ":", "for", "k", ",", "v", "in", "list", "(", "from_d", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "to_...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
pp
Formats (prettyprint) a concatenated dictionary
cufflinks/utils.py
def pp(el,preString=''): """ Formats (prettyprint) a concatenated dictionary """ tab=' '*4 if isinstance(el,dict): keys=list(el.keys()) keys.sort() for key in keys: val=el[key] if isinstance(val,dict) or isinstance(val,list): print('%s%s :' % (preString,key)) pp(val,preString+tab) else: ...
def pp(el,preString=''): """ Formats (prettyprint) a concatenated dictionary """ tab=' '*4 if isinstance(el,dict): keys=list(el.keys()) keys.sort() for key in keys: val=el[key] if isinstance(val,dict) or isinstance(val,list): print('%s%s :' % (preString,key)) pp(val,preString+tab) else: ...
[ "Formats", "(", "prettyprint", ")", "a", "concatenated", "dictionary" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L76-L109
[ "def", "pp", "(", "el", ",", "preString", "=", "''", ")", ":", "tab", "=", "' '", "*", "4", "if", "isinstance", "(", "el", ",", "dict", ")", ":", "keys", "=", "list", "(", "el", ".", "keys", "(", ")", ")", "keys", ".", "sort", "(", ")", "fo...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
inverseDict
Returns a dictionay indexed by values {value_k:key_k} Parameters: ----------- d : dictionary
cufflinks/utils.py
def inverseDict(d): """ Returns a dictionay indexed by values {value_k:key_k} Parameters: ----------- d : dictionary """ dt={} for k,v in list(d.items()): if type(v) in (list,tuple): for i in v: dt[i]=k else: dt[v]=k return dt
def inverseDict(d): """ Returns a dictionay indexed by values {value_k:key_k} Parameters: ----------- d : dictionary """ dt={} for k,v in list(d.items()): if type(v) in (list,tuple): for i in v: dt[i]=k else: dt[v]=k return dt
[ "Returns", "a", "dictionay", "indexed", "by", "values", "{", "value_k", ":", "key_k", "}", "Parameters", ":", "-----------", "d", ":", "dictionary" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L111-L125
[ "def", "inverseDict", "(", "d", ")", ":", "dt", "=", "{", "}", "for", "k", ",", "v", "in", "list", "(", "d", ".", "items", "(", ")", ")", ":", "if", "type", "(", "v", ")", "in", "(", "list", ",", "tuple", ")", ":", "for", "i", "in", "v", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
kwargs_from_keyword
Looks for keys of the format keyword_value. And return a dictionary with {keyword:value} format Parameters: ----------- from_kwargs : dict Original dictionary to_kwargs : dict Dictionary where the items will be appended keyword : string Keyword to look for in the orginal dictionary clean_origin : ...
cufflinks/utils.py
def kwargs_from_keyword(from_kwargs,to_kwargs,keyword,clean_origin=True): """ Looks for keys of the format keyword_value. And return a dictionary with {keyword:value} format Parameters: ----------- from_kwargs : dict Original dictionary to_kwargs : dict Dictionary where the items will be appended key...
def kwargs_from_keyword(from_kwargs,to_kwargs,keyword,clean_origin=True): """ Looks for keys of the format keyword_value. And return a dictionary with {keyword:value} format Parameters: ----------- from_kwargs : dict Original dictionary to_kwargs : dict Dictionary where the items will be appended key...
[ "Looks", "for", "keys", "of", "the", "format", "keyword_value", ".", "And", "return", "a", "dictionary", "with", "{", "keyword", ":", "value", "}", "format" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L129-L151
[ "def", "kwargs_from_keyword", "(", "from_kwargs", ",", "to_kwargs", ",", "keyword", ",", "clean_origin", "=", "True", ")", ":", "for", "k", "in", "list", "(", "from_kwargs", ".", "keys", "(", ")", ")", ":", "if", "'{0}_'", ".", "format", "(", "keyword", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
deep_update
Updates the values (deep form) of a given dictionary Parameters: ----------- d : dict dictionary that contains the values to update d_update : dict dictionary to be updated
cufflinks/utils.py
def deep_update(d,d_update): """ Updates the values (deep form) of a given dictionary Parameters: ----------- d : dict dictionary that contains the values to update d_update : dict dictionary to be updated """ for k,v in list(d_update.items()): if isinstance(v,dict): if k in d: deep_update(d[k...
def deep_update(d,d_update): """ Updates the values (deep form) of a given dictionary Parameters: ----------- d : dict dictionary that contains the values to update d_update : dict dictionary to be updated """ for k,v in list(d_update.items()): if isinstance(v,dict): if k in d: deep_update(d[k...
[ "Updates", "the", "values", "(", "deep", "form", ")", "of", "a", "given", "dictionary" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L203-L224
[ "def", "deep_update", "(", "d", ",", "d_update", ")", ":", "for", "k", ",", "v", "in", "list", "(", "d_update", ".", "items", "(", ")", ")", ":", "if", "isinstance", "(", "v", ",", "dict", ")", ":", "if", "k", "in", "d", ":", "deep_update", "("...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
read_google
Reads a google sheet
cufflinks/utils.py
def read_google(self,url,**kwargs): """ Reads a google sheet """ if url[-1]!='/': url+='/' return self.read_csv(url+'export?gid=0&format=csv',**kwargs)
def read_google(self,url,**kwargs): """ Reads a google sheet """ if url[-1]!='/': url+='/' return self.read_csv(url+'export?gid=0&format=csv',**kwargs)
[ "Reads", "a", "google", "sheet" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/utils.py#L226-L232
[ "def", "read_google", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "if", "url", "[", "-", "1", "]", "!=", "'/'", ":", "url", "+=", "'/'", "return", "self", ".", "read_csv", "(", "url", "+", "'export?gid=0&format=csv'", ",", "*", "*",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
getDateFromToday
Returns a string that represents a date n numbers of days from today. Parameters: ----------- delta : int number of days strfmt : string format in which the date will be represented
cufflinks/date_tools.py
def getDateFromToday(delta,strfmt='%Y%m%d'): """ Returns a string that represents a date n numbers of days from today. Parameters: ----------- delta : int number of days strfmt : string format in which the date will be represented """ return (dt.date.today() + dt.timedelta(delta)).strftime(strfmt)
def getDateFromToday(delta,strfmt='%Y%m%d'): """ Returns a string that represents a date n numbers of days from today. Parameters: ----------- delta : int number of days strfmt : string format in which the date will be represented """ return (dt.date.today() + dt.timedelta(delta)).strftime(strfmt)
[ "Returns", "a", "string", "that", "represents", "a", "date", "n", "numbers", "of", "days", "from", "today", ".", "Parameters", ":", "-----------", "delta", ":", "int", "number", "of", "days", "strfmt", ":", "string", "format", "in", "which", "the", "date",...
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/date_tools.py#L9-L18
[ "def", "getDateFromToday", "(", "delta", ",", "strfmt", "=", "'%Y%m%d'", ")", ":", "return", "(", "dt", ".", "date", ".", "today", "(", ")", "+", "dt", ".", "timedelta", "(", "delta", ")", ")", ".", "strftime", "(", "strfmt", ")" ]
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
_ohlc_dict
Returns a dictionary with the actual column names that correspond to each of the OHLCV values. df_or_figure : DataFrame or Figure open : string Column name to be used for OPEN values high : string Column name to be used for HIGH values low : string Column name to be used for LOW values close : string C...
cufflinks/ta.py
def _ohlc_dict(df_or_figure,open='',high='',low='',close='',volume='', validate='',**kwargs): """ Returns a dictionary with the actual column names that correspond to each of the OHLCV values. df_or_figure : DataFrame or Figure open : string Column name to be used for OPEN values high : string Column...
def _ohlc_dict(df_or_figure,open='',high='',low='',close='',volume='', validate='',**kwargs): """ Returns a dictionary with the actual column names that correspond to each of the OHLCV values. df_or_figure : DataFrame or Figure open : string Column name to be used for OPEN values high : string Column...
[ "Returns", "a", "dictionary", "with", "the", "actual", "column", "names", "that", "correspond", "to", "each", "of", "the", "OHLCV", "values", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/ta.py#L12-L78
[ "def", "_ohlc_dict", "(", "df_or_figure", ",", "open", "=", "''", ",", "high", "=", "''", ",", "low", "=", "''", ",", "close", "=", "''", ",", "volume", "=", "''", ",", "validate", "=", "''", ",", "*", "*", "kwargs", ")", ":", "c_dir", "=", "{"...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
correl
how : string value pct_chg diff
cufflinks/ta.py
def correl(df,periods=21,columns=None,include=True,str=None,detail=False,how='value',**correl_kwargs): """ how : string value pct_chg diff """ def _correl(df,periods=21,columns=None,include=True,str=None,detail=False,**correl_kwargs): study='CORREL' df,_df,columns=validate(df,columns) _df['CORREL']...
def correl(df,periods=21,columns=None,include=True,str=None,detail=False,how='value',**correl_kwargs): """ how : string value pct_chg diff """ def _correl(df,periods=21,columns=None,include=True,str=None,detail=False,**correl_kwargs): study='CORREL' df,_df,columns=validate(df,columns) _df['CORREL']...
[ "how", ":", "string", "value", "pct_chg", "diff" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/ta.py#L409-L436
[ "def", "correl", "(", "df", ",", "periods", "=", "21", ",", "columns", "=", "None", ",", "include", "=", "True", ",", "str", "=", "None", ",", "detail", "=", "False", ",", "how", "=", "'value'", ",", "*", "*", "correl_kwargs", ")", ":", "def", "_...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
scattergeo
Returns
cufflinks/datagen.py
def scattergeo(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/scattergeo.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['text'] = df['airport'] + ' ' + df['city'] + ', ' + df['state'] + ' ' + 'Arrivals: ' + df['cnt'].astype(str) df=df.rename(columns={'cnt':'z','long':'lon'}) retu...
def scattergeo(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/scattergeo.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['text'] = df['airport'] + ' ' + df['city'] + ', ' + df['state'] + ' ' + 'Arrivals: ' + df['cnt'].astype(str) df=df.rename(columns={'cnt':'z','long':'lon'}) retu...
[ "Returns" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L11-L20
[ "def", "scattergeo", "(", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'../data/scattergeo.csv'", ")", "df", "=", "pd", ".", "read_csv", "(", "path", ")", "del", "df", "[...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
choropleth
Returns
cufflinks/datagen.py
def choropleth(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/choropleth.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['z']=[np.random.randint(0,100) for _ in range(len(df))] return df
def choropleth(): """ Returns """ path=os.path.join(os.path.dirname(__file__), '../data/choropleth.csv') df=pd.read_csv(path) del df['Unnamed: 0'] df['z']=[np.random.randint(0,100) for _ in range(len(df))] return df
[ "Returns" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L22-L30
[ "def", "choropleth", "(", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ",", "'../data/choropleth.csv'", ")", "df", "=", "pd", ".", "read_csv", "(", "path", ")", "del", "df", "[...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
pie
Returns a DataFrame with the required format for a pie plot Parameters: ----------- n_labels : int Number of labels mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names
cufflinks/datagen.py
def pie(n_labels=5,mode=None): """ Returns a DataFrame with the required format for a pie plot Parameters: ----------- n_labels : int Number of labels mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names """ return pd.DataFrame({'values':np.random.ra...
def pie(n_labels=5,mode=None): """ Returns a DataFrame with the required format for a pie plot Parameters: ----------- n_labels : int Number of labels mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names """ return pd.DataFrame({'values':np.random.ra...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "pie", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L114-L129
[ "def", "pie", "(", "n_labels", "=", "5", ",", "mode", "=", "None", ")", ":", "return", "pd", ".", "DataFrame", "(", "{", "'values'", ":", "np", ".", "random", ".", "randint", "(", "1", ",", "100", ",", "n_labels", ")", ",", "'labels'", ":", "getN...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
scatter
Returns a DataFrame with the required format for a scatter plot Parameters: ----------- n_categories : int Number of categories n : int Number of points for each category prefix : string Name for each category mode : string Format for each item 'abc' for alphabet columns 'stocks' for r...
cufflinks/datagen.py
def scatter(n_categories=5,n=10,prefix='category',mode=None): """ Returns a DataFrame with the required format for a scatter plot Parameters: ----------- n_categories : int Number of categories n : int Number of points for each category prefix : string Name for each category mode : string Fo...
def scatter(n_categories=5,n=10,prefix='category',mode=None): """ Returns a DataFrame with the required format for a scatter plot Parameters: ----------- n_categories : int Number of categories n : int Number of points for each category prefix : string Name for each category mode : string Fo...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "scatter", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L131-L155
[ "def", "scatter", "(", "n_categories", "=", "5", ",", "n", "=", "10", ",", "prefix", "=", "'category'", ",", "mode", "=", "None", ")", ":", "categories", "=", "[", "]", "for", "i", "in", "range", "(", "n_categories", ")", ":", "categories", ".", "e...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
heatmap
Returns a DataFrame with the required format for a heatmap plot Parameters: ----------- n_x : int Number of x categories n_y : int Number of y categories
cufflinks/datagen.py
def heatmap(n_x=5,n_y=10): """ Returns a DataFrame with the required format for a heatmap plot Parameters: ----------- n_x : int Number of x categories n_y : int Number of y categories """ x=['x_'+str(_) for _ in range(n_x)] y=['y_'+str(_) for _ in range(n_y)] return pd.DataFrame(surface(n_x-1,n_y...
def heatmap(n_x=5,n_y=10): """ Returns a DataFrame with the required format for a heatmap plot Parameters: ----------- n_x : int Number of x categories n_y : int Number of y categories """ x=['x_'+str(_) for _ in range(n_x)] y=['y_'+str(_) for _ in range(n_y)] return pd.DataFrame(surface(n_x-1,n_y...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "heatmap", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L157-L171
[ "def", "heatmap", "(", "n_x", "=", "5", ",", "n_y", "=", "10", ")", ":", "x", "=", "[", "'x_'", "+", "str", "(", "_", ")", "for", "_", "in", "range", "(", "n_x", ")", "]", "y", "=", "[", "'y_'", "+", "str", "(", "_", ")", "for", "_", "i...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
lines
Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool If True it will return a datetime index if False it will return a enu...
cufflinks/datagen.py
def lines(n_traces=5,n=100,columns=None,dateIndex=True,mode=None): """ Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool ...
def lines(n_traces=5,n=100,columns=None,dateIndex=True,mode=None): """ Returns a DataFrame with the required format for a scatter (lines) plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace columns : [str] List of column names dateIndex : bool ...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "scatter", "(", "lines", ")", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L173-L197
[ "def", "lines", "(", "n_traces", "=", "5", ",", "n", "=", "100", ",", "columns", "=", "None", ",", "dateIndex", "=", "True", ",", "mode", "=", "None", ")", ":", "index", "=", "pd", ".", "date_range", "(", "'1/1/15'", ",", "periods", "=", "n", ")"...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
bars
Returns a DataFrame with the required format for a bar plot Parameters: ----------- n : int Number of points for each trace n_categories : int Number of categories for each point prefix : string Name for each category columns : [str] List of column names mode : string Format for each item ...
cufflinks/datagen.py
def bars(n=3,n_categories=3,prefix='category',columns=None,mode='abc'): """ Returns a DataFrame with the required format for a bar plot Parameters: ----------- n : int Number of points for each trace n_categories : int Number of categories for each point prefix : string Name for each category co...
def bars(n=3,n_categories=3,prefix='category',columns=None,mode='abc'): """ Returns a DataFrame with the required format for a bar plot Parameters: ----------- n : int Number of points for each trace n_categories : int Number of categories for each point prefix : string Name for each category co...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "bar", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L199-L225
[ "def", "bars", "(", "n", "=", "3", ",", "n_categories", "=", "3", ",", "prefix", "=", "'category'", ",", "columns", "=", "None", ",", "mode", "=", "'abc'", ")", ":", "categories", "=", "[", "]", "if", "not", "columns", ":", "columns", "=", "getName...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
ohlc
Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close']] Parameters: ----------- n : int Number of ohlc points
cufflinks/datagen.py
def ohlc(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close']] Parameters: ----------- n : int Number of ohlc points """ index=pd.date_range('1/1/15',periods=n*288,freq='5min',tz='utc') data=np.random.randn(n*288) data[0]=np.array(...
def ohlc(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close']] Parameters: ----------- n : int Number of ohlc points """ index=pd.date_range('1/1/15',periods=n*288,freq='5min',tz='utc') data=np.random.randn(n*288) data[0]=np.array(...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "candlestick", "or", "ohlc", "plot", "df", "[[", "open", "high", "low", "close", "]]" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L227-L248
[ "def", "ohlc", "(", "n", "=", "100", ")", ":", "index", "=", "pd", ".", "date_range", "(", "'1/1/15'", ",", "periods", "=", "n", "*", "288", ",", "freq", "=", "'5min'", ",", "tz", "=", "'utc'", ")", "data", "=", "np", ".", "random", ".", "randn...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
ohlcv
Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close','volume'] Parameters: ----------- n : int Number of ohlc points
cufflinks/datagen.py
def ohlcv(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close','volume'] Parameters: ----------- n : int Number of ohlc points """ df=ohlc() df['volume']=[np.random.randint(1000,10000) for _ in range(len(df))] return df
def ohlcv(n=100): """ Returns a DataFrame with the required format for a candlestick or ohlc plot df[['open','high','low','close','volume'] Parameters: ----------- n : int Number of ohlc points """ df=ohlc() df['volume']=[np.random.randint(1000,10000) for _ in range(len(df))] return df
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "candlestick", "or", "ohlc", "plot", "df", "[[", "open", "high", "low", "close", "volume", "]" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L250-L264
[ "def", "ohlcv", "(", "n", "=", "100", ")", ":", "df", "=", "ohlc", "(", ")", "df", "[", "'volume'", "]", "=", "[", "np", ".", "random", ".", "randint", "(", "1000", ",", "10000", ")", "for", "_", "in", "range", "(", "len", "(", "df", ")", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
box
Returns a DataFrame with the required format for a box plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names
cufflinks/datagen.py
def box(n_traces=5,n=100,mode=None): """ Returns a DataFrame with the required format for a box plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock name...
def box(n_traces=5,n=100,mode=None): """ Returns a DataFrame with the required format for a box plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock name...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "box", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L266-L284
[ "def", "box", "(", "n_traces", "=", "5", ",", "n", "=", "100", ",", "mode", "=", "None", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "[", "np", ".", "random", ".", "chisquare", "(", "np", ".", "random", ".", "randint", "(", "2", ",", "1...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
histogram
Returns a DataFrame with the required format for a histogram plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names
cufflinks/datagen.py
def histogram(n_traces=1,n=500,dispersion=2,mode=None): """ Returns a DataFrame with the required format for a histogram plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stoc...
def histogram(n_traces=1,n=500,dispersion=2,mode=None): """ Returns a DataFrame with the required format for a histogram plot Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stoc...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "histogram", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L286-L304
[ "def", "histogram", "(", "n_traces", "=", "1", ",", "n", "=", "500", ",", "dispersion", "=", "2", ",", "mode", "=", "None", ")", ":", "df", "=", "pd", ".", "DataFrame", "(", "np", ".", "transpose", "(", "[", "np", ".", "random", ".", "randn", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
distplot
Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet columns 'stocks' for random stock names
cufflinks/datagen.py
def distplot(n_traces=1,n=500,dispersion=3,mode=None): """ Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet colu...
def distplot(n_traces=1,n=500,dispersion=3,mode=None): """ Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n_traces : int Number of traces n : int Number of points for each trace mode : string Format for each item 'abc' for alphabet colu...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "distribution", "plot", "(", "distplot", ")" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L306-L322
[ "def", "distplot", "(", "n_traces", "=", "1", ",", "n", "=", "500", ",", "dispersion", "=", "3", ",", "mode", "=", "None", ")", ":", "return", "histogram", "(", "n_traces", ",", "n", ",", "dispersion", ",", "mode", ")" ]
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
violin
Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n : int Number of points categories : bool or int If True, then a column with categories is added n_categories : int Number of categories
cufflinks/datagen.py
def violin(n=500,dispersion=3,categories=True,n_categories=5): """ Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n : int Number of points categories : bool or int If True, then a column with categories is added n_categories : int Number of...
def violin(n=500,dispersion=3,categories=True,n_categories=5): """ Returns a DataFrame with the required format for a distribution plot (distplot) Parameters: ----------- n : int Number of points categories : bool or int If True, then a column with categories is added n_categories : int Number of...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "distribution", "plot", "(", "distplot", ")" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L324-L342
[ "def", "violin", "(", "n", "=", "500", ",", "dispersion", "=", "3", ",", "categories", "=", "True", ",", "n_categories", "=", "5", ")", ":", "df", "=", "histogram", "(", "1", ",", "n", ",", "dispersion", ",", "'abc'", ")", "df", "=", "df", ".", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
surface
Returns a DataFrame with the required format for a surface plot Parameters: ----------- n_x : int Number of points along the X axis n_y : int Number of points along the Y axis
cufflinks/datagen.py
def surface(n_x=20,n_y=20): """ Returns a DataFrame with the required format for a surface plot Parameters: ----------- n_x : int Number of points along the X axis n_y : int Number of points along the Y axis """ x=[float(np.random.randint(0,100))] for i in range(n_x): x.append(x[:1][0]+np.random....
def surface(n_x=20,n_y=20): """ Returns a DataFrame with the required format for a surface plot Parameters: ----------- n_x : int Number of points along the X axis n_y : int Number of points along the Y axis """ x=[float(np.random.randint(0,100))] for i in range(n_x): x.append(x[:1][0]+np.random....
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "surface", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L344-L362
[ "def", "surface", "(", "n_x", "=", "20", ",", "n_y", "=", "20", ")", ":", "x", "=", "[", "float", "(", "np", ".", "random", ".", "randint", "(", "0", ",", "100", ")", ")", "]", "for", "i", "in", "range", "(", "n_x", ")", ":", "x", ".", "a...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
sinwave
Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis
cufflinks/datagen.py
def sinwave(n=4,inc=.25): """ Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis """ x=np.arange(-n,n,inc) y=np.arange(-n,n,inc) X,Y=np.meshgrid(x,y) R = np.sqrt(X**2...
def sinwave(n=4,inc=.25): """ Returns a DataFrame with the required format for a surface (sine wave) plot Parameters: ----------- n : int Ranges for X and Y axis (-n,n) n_y : int Size of increment along the axis """ x=np.arange(-n,n,inc) y=np.arange(-n,n,inc) X,Y=np.meshgrid(x,y) R = np.sqrt(X**2...
[ "Returns", "a", "DataFrame", "with", "the", "required", "format", "for", "a", "surface", "(", "sine", "wave", ")", "plot" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/datagen.py#L364-L381
[ "def", "sinwave", "(", "n", "=", "4", ",", "inc", "=", ".25", ")", ":", "x", "=", "np", ".", "arange", "(", "-", "n", ",", "n", ",", "inc", ")", "y", "=", "np", ".", "arange", "(", "-", "n", ",", "n", ",", "inc", ")", "X", ",", "Y", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
getTheme
Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead.
cufflinks/tools.py
def getTheme(theme=None): """ Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead. """ if not theme: theme = auth.get_config_file()['theme'] if theme in THEMES: return updateColors(copy.deepcopy(THEMES[theme])) else: raise Exception("Invalid Theme: {0}"....
def getTheme(theme=None): """ Returns a theme definition. To see the colors translated (hex) use cufflinks.getLayout(theme) instead. """ if not theme: theme = auth.get_config_file()['theme'] if theme in THEMES: return updateColors(copy.deepcopy(THEMES[theme])) else: raise Exception("Invalid Theme: {0}"....
[ "Returns", "a", "theme", "definition", "." ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L54-L67
[ "def", "getTheme", "(", "theme", "=", "None", ")", ":", "if", "not", "theme", ":", "theme", "=", "auth", ".", "get_config_file", "(", ")", "[", "'theme'", "]", "if", "theme", "in", "THEMES", ":", "return", "updateColors", "(", "copy", ".", "deepcopy", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
getLayout
Generates a plotly Layout Parameters: ----------- theme : string Layout Theme solar pearl white title : string Chart Title xTitle : string X Axis Title yTitle : string Y Axis Title zTitle : string Z Axis Title Applicable only for 3d charts barmode : string Mode when displ...
cufflinks/tools.py
def getLayout(kind=None,theme=None,title='',xTitle='',yTitle='',zTitle='',barmode='',bargap=None,bargroupgap=None, margin=None, dimensions=None, width=None, height=None, annotations=None,is3d=False,**kwargs): """ Generates a plotly Layout Parameters: ----------- theme : string Layout Theme solar...
def getLayout(kind=None,theme=None,title='',xTitle='',yTitle='',zTitle='',barmode='',bargap=None,bargroupgap=None, margin=None, dimensions=None, width=None, height=None, annotations=None,is3d=False,**kwargs): """ Generates a plotly Layout Parameters: ----------- theme : string Layout Theme solar...
[ "Generates", "a", "plotly", "Layout" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L92-L455
[ "def", "getLayout", "(", "kind", "=", "None", ",", "theme", "=", "None", ",", "title", "=", "''", ",", "xTitle", "=", "''", ",", "yTitle", "=", "''", ",", "zTitle", "=", "''", ",", "barmode", "=", "''", ",", "bargap", "=", "None", ",", "bargroupg...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
get_annotations
Generates an annotations object Parameters: ----------- df : DataFrame Original DataFrame of values annotations : dict or list Dictionary of annotations {x_point : text} or List of Plotly annotations
cufflinks/tools.py
def get_annotations(df,annotations,kind='lines',theme=None,**kwargs): """ Generates an annotations object Parameters: ----------- df : DataFrame Original DataFrame of values annotations : dict or list Dictionary of annotations {x_point : text} or List of Plotly annotations """ for key in ...
def get_annotations(df,annotations,kind='lines',theme=None,**kwargs): """ Generates an annotations object Parameters: ----------- df : DataFrame Original DataFrame of values annotations : dict or list Dictionary of annotations {x_point : text} or List of Plotly annotations """ for key in ...
[ "Generates", "an", "annotations", "object" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L458-L561
[ "def", "get_annotations", "(", "df", ",", "annotations", ",", "kind", "=", "'lines'", ",", "theme", "=", "None", ",", "*", "*", "kwargs", ")", ":", "for", "key", "in", "list", "(", "kwargs", ".", "keys", "(", ")", ")", ":", "if", "key", "not", "i...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
strip_figures
Strips a figure into multiple figures with a trace on each of them Parameters: ----------- figure : Figure Plotly Figure
cufflinks/tools.py
def strip_figures(figure): """ Strips a figure into multiple figures with a trace on each of them Parameters: ----------- figure : Figure Plotly Figure """ fig=[] for trace in figure['data']: fig.append(dict(data=[trace],layout=figure['layout'])) return fig
def strip_figures(figure): """ Strips a figure into multiple figures with a trace on each of them Parameters: ----------- figure : Figure Plotly Figure """ fig=[] for trace in figure['data']: fig.append(dict(data=[trace],layout=figure['layout'])) return fig
[ "Strips", "a", "figure", "into", "multiple", "figures", "with", "a", "trace", "on", "each", "of", "them" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L564-L576
[ "def", "strip_figures", "(", "figure", ")", ":", "fig", "=", "[", "]", "for", "trace", "in", "figure", "[", "'data'", "]", ":", "fig", ".", "append", "(", "dict", "(", "data", "=", "[", "trace", "]", ",", "layout", "=", "figure", "[", "'layout'", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
get_base_layout
Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures
cufflinks/tools.py
def get_base_layout(figs): """ Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures """ layout={} for fig in figs: if not isinstance(fig,dict): fig=fig.to_dict() for k,v in list(fig['layout'].items()): ...
def get_base_layout(figs): """ Generates a layout with the union of all properties of multiple figures' layouts Parameters: ----------- fig : list(Figures) List of Plotly Figures """ layout={} for fig in figs: if not isinstance(fig,dict): fig=fig.to_dict() for k,v in list(fig['layout'].items()): ...
[ "Generates", "a", "layout", "with", "the", "union", "of", "all", "properties", "of", "multiple", "figures", "layouts" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L579-L595
[ "def", "get_base_layout", "(", "figs", ")", ":", "layout", "=", "{", "}", "for", "fig", "in", "figs", ":", "if", "not", "isinstance", "(", "fig", ",", "dict", ")", ":", "fig", "=", "fig", ".", "to_dict", "(", ")", "for", "k", ",", "v", "in", "l...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
figures
Generates multiple Plotly figures for a given DataFrame Parameters: ----------- df : DataFrame Pandas DataFrame specs : list(dict) List of dictionaries with the properties of each figure. All properties avaialbe can be seen with help(cufflinks.pd.DataFrame.iplot) asList : boolean If True, the...
cufflinks/tools.py
def figures(df,specs,asList=False): """ Generates multiple Plotly figures for a given DataFrame Parameters: ----------- df : DataFrame Pandas DataFrame specs : list(dict) List of dictionaries with the properties of each figure. All properties avaialbe can be seen with help(cufflinks.pd.DataFrame...
def figures(df,specs,asList=False): """ Generates multiple Plotly figures for a given DataFrame Parameters: ----------- df : DataFrame Pandas DataFrame specs : list(dict) List of dictionaries with the properties of each figure. All properties avaialbe can be seen with help(cufflinks.pd.DataFrame...
[ "Generates", "multiple", "Plotly", "figures", "for", "a", "given", "DataFrame" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L597-L621
[ "def", "figures", "(", "df", ",", "specs", ",", "asList", "=", "False", ")", ":", "figs", "=", "[", "]", "for", "spec", "in", "specs", ":", "figs", ".", "append", "(", "df", ".", "figure", "(", "*", "*", "spec", ")", ")", "if", "asList", ":", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
merge_figures
Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged.
cufflinks/tools.py
def merge_figures(figures): """ Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged. """ figure={} data=[] for fig in figures: for trace in fig['data']: data.append(trace) layout=get_base_layout(figures) figure['data']=data ...
def merge_figures(figures): """ Generates a single Figure from a list of figures Parameters: ----------- figures : list(Figures) List of figures to be merged. """ figure={} data=[] for fig in figures: for trace in fig['data']: data.append(trace) layout=get_base_layout(figures) figure['data']=data ...
[ "Generates", "a", "single", "Figure", "from", "a", "list", "of", "figures" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L623-L640
[ "def", "merge_figures", "(", "figures", ")", ":", "figure", "=", "{", "}", "data", "=", "[", "]", "for", "fig", "in", "figures", ":", "for", "trace", "in", "fig", "[", "'data'", "]", ":", "data", ".", "append", "(", "trace", ")", "layout", "=", "...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
subplots
Generates a subplot view for a set of figures This is a wrapper for plotly.tools.make_subplots Parameters: ----------- figures : [Figures] List of Plotly Figures shape : (rows,cols) Tuple indicating the size of rows and columns If omitted then the layout is automatically set shared_xaxes : bool As...
cufflinks/tools.py
def subplots(figures,shape=None, shared_xaxes=False, shared_yaxes=False, start_cell='top-left', theme=None,base_layout=None, **kwargs): """ Generates a subplot view for a set of figures This is a wrapper for plotly.tools.make_subplots Parameters: ----------- figures : [Figures] List of Plot...
def subplots(figures,shape=None, shared_xaxes=False, shared_yaxes=False, start_cell='top-left', theme=None,base_layout=None, **kwargs): """ Generates a subplot view for a set of figures This is a wrapper for plotly.tools.make_subplots Parameters: ----------- figures : [Figures] List of Plot...
[ "Generates", "a", "subplot", "view", "for", "a", "set", "of", "figures", "This", "is", "a", "wrapper", "for", "plotly", ".", "tools", ".", "make_subplots" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L642-L793
[ "def", "subplots", "(", "figures", ",", "shape", "=", "None", ",", "shared_xaxes", "=", "False", ",", "shared_yaxes", "=", "False", ",", "start_cell", "=", "'top-left'", ",", "theme", "=", "None", ",", "base_layout", "=", "None", ",", "*", "*", "kwargs",...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
get_subplots
Generates a subplot view for a set of figures Parameters: ----------- rows : int Number of rows cols : int Number of cols shared_xaxes : bool Assign shared x axes. If True, subplots in the same grid column have one common shared x-axis at the bottom of the gird. shared_yaxes : bool Assign s...
cufflinks/tools.py
def get_subplots(rows=1,cols=1, shared_xaxes=False, shared_yaxes=False, start_cell='top-left', theme=None,base_layout=None, **kwargs): """ Generates a subplot view for a set of figures Parameters: ----------- rows : int Number of rows cols : int Number of cols shared_xaxes : bool ...
def get_subplots(rows=1,cols=1, shared_xaxes=False, shared_yaxes=False, start_cell='top-left', theme=None,base_layout=None, **kwargs): """ Generates a subplot view for a set of figures Parameters: ----------- rows : int Number of rows cols : int Number of cols shared_xaxes : bool ...
[ "Generates", "a", "subplot", "view", "for", "a", "set", "of", "figures" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L796-L936
[ "def", "get_subplots", "(", "rows", "=", "1", ",", "cols", "=", "1", ",", "shared_xaxes", "=", "False", ",", "shared_yaxes", "=", "False", ",", "start_cell", "=", "'top-left'", ",", "theme", "=", "None", ",", "base_layout", "=", "None", ",", "*", "*", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
scatter_matrix
Displays a matrix with scatter plot for each pair of Series in the DataFrame. The diagonal shows a histogram for each of the Series Parameters: ----------- df : DataFrame Pandas DataFrame theme : string Theme to be used (if not the default) bins : int Number of bins to use for histogram color : st...
cufflinks/tools.py
def scatter_matrix(df,theme=None,bins=10,color='grey',size=2): """ Displays a matrix with scatter plot for each pair of Series in the DataFrame. The diagonal shows a histogram for each of the Series Parameters: ----------- df : DataFrame Pandas DataFrame theme : string Theme to be used (if not the defa...
def scatter_matrix(df,theme=None,bins=10,color='grey',size=2): """ Displays a matrix with scatter plot for each pair of Series in the DataFrame. The diagonal shows a histogram for each of the Series Parameters: ----------- df : DataFrame Pandas DataFrame theme : string Theme to be used (if not the defa...
[ "Displays", "a", "matrix", "with", "scatter", "plot", "for", "each", "pair", "of", "Series", "in", "the", "DataFrame", ".", "The", "diagonal", "shows", "a", "histogram", "for", "each", "of", "the", "Series" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L986-L1022
[ "def", "scatter_matrix", "(", "df", ",", "theme", "=", "None", ",", "bins", "=", "10", ",", "color", "=", "'grey'", ",", "size", "=", "2", ")", ":", "if", "not", "theme", ":", "theme", "=", "auth", ".", "get_config_file", "(", ")", "[", "'theme'", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
_set_axis
Sets the axis in which each trace should appear If the axis doesn't exist then a new axis is created Parameters: ----------- traces : list(str) List of trace names on : string The axis in which the traces should be placed. If this is not indicated then a new axis will be created side : string S...
cufflinks/tools.py
def _set_axis(self,traces,on=None,side='right',title=''): """ Sets the axis in which each trace should appear If the axis doesn't exist then a new axis is created Parameters: ----------- traces : list(str) List of trace names on : string The axis in which the traces should be placed. If this is not i...
def _set_axis(self,traces,on=None,side='right',title=''): """ Sets the axis in which each trace should appear If the axis doesn't exist then a new axis is created Parameters: ----------- traces : list(str) List of trace names on : string The axis in which the traces should be placed. If this is not i...
[ "Sets", "the", "axis", "in", "which", "each", "trace", "should", "appear", "If", "the", "axis", "doesn", "t", "exist", "then", "a", "new", "axis", "is", "created" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L1117-L1179
[ "def", "_set_axis", "(", "self", ",", "traces", ",", "on", "=", "None", ",", "side", "=", "'right'", ",", "title", "=", "''", ")", ":", "fig", "=", "{", "}", "fig_cpy", "=", "fig_to_dict", "(", "self", ")", ".", "copy", "(", ")", "fig", "[", "'...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
get_shape
Returns a plotly shape Parameters: ----------- kind : string Shape kind line rect circle x : float x values for the shape. This assumes x0=x1 x0 : float x0 value for the shape x1 : float x1 value for the shape y : float y values for the shape. This assumes y0=y1 y0 : floa...
cufflinks/tools.py
def get_shape(kind='line',x=None,y=None,x0=None,y0=None,x1=None,y1=None,span=0,color='red',dash='solid',width=1, fillcolor=None,fill=False,opacity=1,xref='x',yref='y'): """ Returns a plotly shape Parameters: ----------- kind : string Shape kind line rect circle x : float x values for the ...
def get_shape(kind='line',x=None,y=None,x0=None,y0=None,x1=None,y1=None,span=0,color='red',dash='solid',width=1, fillcolor=None,fill=False,opacity=1,xref='x',yref='y'): """ Returns a plotly shape Parameters: ----------- kind : string Shape kind line rect circle x : float x values for the ...
[ "Returns", "a", "plotly", "shape" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L1252-L1361
[ "def", "get_shape", "(", "kind", "=", "'line'", ",", "x", "=", "None", ",", "y", "=", "None", ",", "x0", "=", "None", ",", "y0", "=", "None", ",", "x1", "=", "None", ",", "y1", "=", "None", ",", "span", "=", "0", ",", "color", "=", "'red'", ...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
get_range_selector
Returns a range selector Reference: https://plot.ly/python/reference/#layout-xaxis-rangeselector Parameters: ----------- steps : string or list(string) Steps for the range Examples: ['1y','2 months','5 weeks','ytd','2mtd'] bgocolor : string or tuple(color,alpha) Background color Examples: ...
cufflinks/tools.py
def get_range_selector(steps=['1m','1y'],bgcolor='rgba(150, 200, 250, 0.4)',x=0,y=0.9, visible=True,**kwargs): """ Returns a range selector Reference: https://plot.ly/python/reference/#layout-xaxis-rangeselector Parameters: ----------- steps : string or list(string) Steps for the range Examples: ...
def get_range_selector(steps=['1m','1y'],bgcolor='rgba(150, 200, 250, 0.4)',x=0,y=0.9, visible=True,**kwargs): """ Returns a range selector Reference: https://plot.ly/python/reference/#layout-xaxis-rangeselector Parameters: ----------- steps : string or list(string) Steps for the range Examples: ...
[ "Returns", "a", "range", "selector", "Reference", ":", "https", ":", "//", "plot", ".", "ly", "/", "python", "/", "reference", "/", "#layout", "-", "xaxis", "-", "rangeselector" ]
santosjorge/cufflinks
python
https://github.com/santosjorge/cufflinks/blob/ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a/cufflinks/tools.py#L1376-L1462
[ "def", "get_range_selector", "(", "steps", "=", "[", "'1m'", ",", "'1y'", "]", ",", "bgcolor", "=", "'rgba(150, 200, 250, 0.4)'", ",", "x", "=", "0", ",", "y", "=", "0.9", ",", "visible", "=", "True", ",", "*", "*", "kwargs", ")", ":", "import", "str...
ca1cbf93998dc793d0b1f8ac30fe1f2bd105f63a
train
view_label_matrix
Display an [n, m] matrix of labels
metal/contrib/visualization/analysis.py
def view_label_matrix(L, colorbar=True): """Display an [n, m] matrix of labels""" L = L.todense() if sparse.issparse(L) else L plt.imshow(L, aspect="auto") plt.title("Label Matrix") if colorbar: labels = sorted(np.unique(np.asarray(L).reshape(-1, 1).squeeze())) boundaries = np.array(...
def view_label_matrix(L, colorbar=True): """Display an [n, m] matrix of labels""" L = L.todense() if sparse.issparse(L) else L plt.imshow(L, aspect="auto") plt.title("Label Matrix") if colorbar: labels = sorted(np.unique(np.asarray(L).reshape(-1, 1).squeeze())) boundaries = np.array(...
[ "Display", "an", "[", "n", "m", "]", "matrix", "of", "labels" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/visualization/analysis.py#L10-L19
[ "def", "view_label_matrix", "(", "L", ",", "colorbar", "=", "True", ")", ":", "L", "=", "L", ".", "todense", "(", ")", "if", "sparse", ".", "issparse", "(", "L", ")", "else", "L", "plt", ".", "imshow", "(", "L", ",", "aspect", "=", "\"auto\"", ")...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
view_overlaps
Display an [m, m] matrix of overlaps
metal/contrib/visualization/analysis.py
def view_overlaps(L, self_overlaps=False, normalize=True, colorbar=True): """Display an [m, m] matrix of overlaps""" L = L.todense() if sparse.issparse(L) else L G = _get_overlaps_matrix(L, normalize=normalize) if not self_overlaps: np.fill_diagonal(G, 0) # Zero out self-overlaps plt.imshow...
def view_overlaps(L, self_overlaps=False, normalize=True, colorbar=True): """Display an [m, m] matrix of overlaps""" L = L.todense() if sparse.issparse(L) else L G = _get_overlaps_matrix(L, normalize=normalize) if not self_overlaps: np.fill_diagonal(G, 0) # Zero out self-overlaps plt.imshow...
[ "Display", "an", "[", "m", "m", "]", "matrix", "of", "overlaps" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/visualization/analysis.py#L22-L32
[ "def", "view_overlaps", "(", "L", ",", "self_overlaps", "=", "False", ",", "normalize", "=", "True", ",", "colorbar", "=", "True", ")", ":", "L", "=", "L", ".", "todense", "(", ")", "if", "sparse", ".", "issparse", "(", "L", ")", "else", "L", "G", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
view_conflicts
Display an [m, m] matrix of conflicts
metal/contrib/visualization/analysis.py
def view_conflicts(L, normalize=True, colorbar=True): """Display an [m, m] matrix of conflicts""" L = L.todense() if sparse.issparse(L) else L C = _get_conflicts_matrix(L, normalize=normalize) plt.imshow(C, aspect="auto") plt.title("Conflicts") if colorbar: plt.colorbar() plt.show()
def view_conflicts(L, normalize=True, colorbar=True): """Display an [m, m] matrix of conflicts""" L = L.todense() if sparse.issparse(L) else L C = _get_conflicts_matrix(L, normalize=normalize) plt.imshow(C, aspect="auto") plt.title("Conflicts") if colorbar: plt.colorbar() plt.show()
[ "Display", "an", "[", "m", "m", "]", "matrix", "of", "conflicts" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/visualization/analysis.py#L35-L43
[ "def", "view_conflicts", "(", "L", ",", "normalize", "=", "True", ",", "colorbar", "=", "True", ")", ":", "L", "=", "L", ".", "todense", "(", ")", "if", "sparse", ".", "issparse", "(", "L", ")", "else", "L", "C", "=", "_get_conflicts_matrix", "(", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
plot_probabilities_histogram
Plot a histogram from a numpy array of probabilities Args: Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1])
metal/contrib/visualization/analysis.py
def plot_probabilities_histogram(Y_p, title=None): """Plot a histogram from a numpy array of probabilities Args: Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1]) """ if Y_p.ndim > 1: msg = ( f"Arg Y_p should be a 1-dimensional np.ndarray, not of shape " ...
def plot_probabilities_histogram(Y_p, title=None): """Plot a histogram from a numpy array of probabilities Args: Y_p: An [n] or [n, 1] np.ndarray of probabilities (floats in [0,1]) """ if Y_p.ndim > 1: msg = ( f"Arg Y_p should be a 1-dimensional np.ndarray, not of shape " ...
[ "Plot", "a", "histogram", "from", "a", "numpy", "array", "of", "probabilities" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/visualization/analysis.py#L79-L97
[ "def", "plot_probabilities_histogram", "(", "Y_p", ",", "title", "=", "None", ")", ":", "if", "Y_p", ".", "ndim", ">", "1", ":", "msg", "=", "(", "f\"Arg Y_p should be a 1-dimensional np.ndarray, not of shape \"", "f\"{Y_p.shape}.\"", ")", "raise", "ValueError", "("...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
plot_predictions_histogram
Plot a histogram comparing int predictions vs true labels by class Args: Y_ph: An [n] or [n, 1] np.ndarray of predicted int labels Y: An [n] or [n, 1] np.ndarray of gold labels
metal/contrib/visualization/analysis.py
def plot_predictions_histogram(Y_ph, Y, title=None): """Plot a histogram comparing int predictions vs true labels by class Args: Y_ph: An [n] or [n, 1] np.ndarray of predicted int labels Y: An [n] or [n, 1] np.ndarray of gold labels """ labels = list(set(Y).union(set(Y_ph))) edges =...
def plot_predictions_histogram(Y_ph, Y, title=None): """Plot a histogram comparing int predictions vs true labels by class Args: Y_ph: An [n] or [n, 1] np.ndarray of predicted int labels Y: An [n] or [n, 1] np.ndarray of gold labels """ labels = list(set(Y).union(set(Y_ph))) edges =...
[ "Plot", "a", "histogram", "comparing", "int", "predictions", "vs", "true", "labels", "by", "class" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/visualization/analysis.py#L100-L118
[ "def", "plot_predictions_histogram", "(", "Y_ph", ",", "Y", ",", "title", "=", "None", ")", ":", "labels", "=", "list", "(", "set", "(", "Y", ")", ".", "union", "(", "set", "(", "Y_ph", ")", ")", ")", "edges", "=", "[", "x", "-", "0.5", "for", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
get_clique_tree
Given a set of int nodes i and edges (i,j), returns an nx.Graph object G which is a clique tree, where: - G.node[i]['members'] contains the set of original nodes in the ith maximal clique - G[i][j]['members'] contains the set of original nodes in the seperator set between max...
metal/label_model/graph_utils.py
def get_clique_tree(nodes, edges): """Given a set of int nodes i and edges (i,j), returns an nx.Graph object G which is a clique tree, where: - G.node[i]['members'] contains the set of original nodes in the ith maximal clique - G[i][j]['members'] contains the set of original nodes in...
def get_clique_tree(nodes, edges): """Given a set of int nodes i and edges (i,j), returns an nx.Graph object G which is a clique tree, where: - G.node[i]['members'] contains the set of original nodes in the ith maximal clique - G[i][j]['members'] contains the set of original nodes in...
[ "Given", "a", "set", "of", "int", "nodes", "i", "and", "edges", "(", "i", "j", ")", "returns", "an", "nx", ".", "Graph", "object", "G", "which", "is", "a", "clique", "tree", "where", ":", "-", "G", ".", "node", "[", "i", "]", "[", "members", "]...
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/label_model/graph_utils.py#L4-L39
[ "def", "get_clique_tree", "(", "nodes", ",", "edges", ")", ":", "# Form the original graph G1", "G1", "=", "nx", ".", "Graph", "(", ")", "G1", ".", "add_nodes_from", "(", "nodes", ")", "G1", ".", "add_edges_from", "(", "edges", ")", "# Check if graph is chorda...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Logger.check
Returns True if the logging frequency has been met.
metal/logging/logger.py
def check(self, batch_size): """Returns True if the logging frequency has been met.""" self.increment(batch_size) return self.unit_count >= self.config["log_train_every"]
def check(self, batch_size): """Returns True if the logging frequency has been met.""" self.increment(batch_size) return self.unit_count >= self.config["log_train_every"]
[ "Returns", "True", "if", "the", "logging", "frequency", "has", "been", "met", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L37-L40
[ "def", "check", "(", "self", ",", "batch_size", ")", ":", "self", ".", "increment", "(", "batch_size", ")", "return", "self", ".", "unit_count", ">=", "self", ".", "config", "[", "\"log_train_every\"", "]" ]
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Logger.increment
Update the total and relative unit counts
metal/logging/logger.py
def increment(self, batch_size): """Update the total and relative unit counts""" self.example_count += batch_size self.example_total += batch_size if self.log_unit == "seconds": self.unit_count = int(self.timer.elapsed()) self.unit_total = int(self.timer.total_ela...
def increment(self, batch_size): """Update the total and relative unit counts""" self.example_count += batch_size self.example_total += batch_size if self.log_unit == "seconds": self.unit_count = int(self.timer.elapsed()) self.unit_total = int(self.timer.total_ela...
[ "Update", "the", "total", "and", "relative", "unit", "counts" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L42-L62
[ "def", "increment", "(", "self", ",", "batch_size", ")", ":", "self", ".", "example_count", "+=", "batch_size", "self", ".", "example_total", "+=", "batch_size", "if", "self", ".", "log_unit", "==", "\"seconds\"", ":", "self", ".", "unit_count", "=", "int", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Logger.calculate_metrics
Add standard and custom metrics to metrics_dict
metal/logging/logger.py
def calculate_metrics(self, model, train_loader, valid_loader, metrics_dict): """Add standard and custom metrics to metrics_dict""" # Check whether or not it's time for validation as well self.log_count += 1 log_valid = ( valid_loader is not None and self.valid_ev...
def calculate_metrics(self, model, train_loader, valid_loader, metrics_dict): """Add standard and custom metrics to metrics_dict""" # Check whether or not it's time for validation as well self.log_count += 1 log_valid = ( valid_loader is not None and self.valid_ev...
[ "Add", "standard", "and", "custom", "metrics", "to", "metrics_dict" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L64-L102
[ "def", "calculate_metrics", "(", "self", ",", "model", ",", "train_loader", ",", "valid_loader", ",", "metrics_dict", ")", ":", "# Check whether or not it's time for validation as well", "self", ".", "log_count", "+=", "1", "log_valid", "=", "(", "valid_loader", "is",...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Logger.log
Print calculated metrics and optionally write to file (json/tb)
metal/logging/logger.py
def log(self, metrics_dict): """Print calculated metrics and optionally write to file (json/tb)""" if self.writer: self.write_to_file(metrics_dict) if self.verbose: self.print_to_screen(metrics_dict) self.reset()
def log(self, metrics_dict): """Print calculated metrics and optionally write to file (json/tb)""" if self.writer: self.write_to_file(metrics_dict) if self.verbose: self.print_to_screen(metrics_dict) self.reset()
[ "Print", "calculated", "metrics", "and", "optionally", "write", "to", "file", "(", "json", "/", "tb", ")" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L171-L178
[ "def", "log", "(", "self", ",", "metrics_dict", ")", ":", "if", "self", ".", "writer", ":", "self", ".", "write_to_file", "(", "metrics_dict", ")", "if", "self", ".", "verbose", ":", "self", ".", "print_to_screen", "(", "metrics_dict", ")", "self", ".", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Logger.print_to_screen
Print all metrics in metrics_dict to screen
metal/logging/logger.py
def print_to_screen(self, metrics_dict): """Print all metrics in metrics_dict to screen""" score_strings = defaultdict(list) for split_metric, value in metrics_dict.items(): split, metric = split_metric.split("/", 1) if isinstance(value, float): score_str...
def print_to_screen(self, metrics_dict): """Print all metrics in metrics_dict to screen""" score_strings = defaultdict(list) for split_metric, value in metrics_dict.items(): split, metric = split_metric.split("/", 1) if isinstance(value, float): score_str...
[ "Print", "all", "metrics", "in", "metrics_dict", "to", "screen" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/logging/logger.py#L180-L203
[ "def", "print_to_screen", "(", "self", ",", "metrics_dict", ")", ":", "score_strings", "=", "defaultdict", "(", "list", ")", "for", "split_metric", ",", "value", "in", "metrics_dict", ".", "items", "(", ")", ":", "split", ",", "metric", "=", "split_metric", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
LSTMModule._reduce_output
Reduces the output of an LSTM step Args: outputs: (torch.FloatTensor) the hidden state outputs from the lstm, with shape [batch_size, max_seq_length, hidden_size]
metal/contrib/modules/lstm_module.py
def _reduce_output(self, outputs, seq_lengths): """Reduces the output of an LSTM step Args: outputs: (torch.FloatTensor) the hidden state outputs from the lstm, with shape [batch_size, max_seq_length, hidden_size] """ batch_size = outputs.shape[0] red...
def _reduce_output(self, outputs, seq_lengths): """Reduces the output of an LSTM step Args: outputs: (torch.FloatTensor) the hidden state outputs from the lstm, with shape [batch_size, max_seq_length, hidden_size] """ batch_size = outputs.shape[0] red...
[ "Reduces", "the", "output", "of", "an", "LSTM", "step" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/modules/lstm_module.py#L190-L221
[ "def", "_reduce_output", "(", "self", ",", "outputs", ",", "seq_lengths", ")", ":", "batch_size", "=", "outputs", ".", "shape", "[", "0", "]", "reduced", "=", "[", "]", "# Necessary to iterate over batch because of different sequence lengths", "for", "i", "in", "r...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
LSTMModule.forward
Applies one step of an lstm (plus reduction) to the input X, which is handled by self.encoder
metal/contrib/modules/lstm_module.py
def forward(self, X): """Applies one step of an lstm (plus reduction) to the input X, which is handled by self.encoder""" # Identify the first non-zero integer from the right (i.e., the length # of the sequence before padding starts). batch_size, max_seq = X.shape[0], X.shape[1] ...
def forward(self, X): """Applies one step of an lstm (plus reduction) to the input X, which is handled by self.encoder""" # Identify the first non-zero integer from the right (i.e., the length # of the sequence before padding starts). batch_size, max_seq = X.shape[0], X.shape[1] ...
[ "Applies", "one", "step", "of", "an", "lstm", "(", "plus", "reduction", ")", "to", "the", "input", "X", "which", "is", "handled", "by", "self", ".", "encoder" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/modules/lstm_module.py#L223-L256
[ "def", "forward", "(", "self", ",", "X", ")", ":", "# Identify the first non-zero integer from the right (i.e., the length", "# of the sequence before padding starts).", "batch_size", ",", "max_seq", "=", "X", ".", "shape", "[", "0", "]", ",", "X", ".", "shape", "[", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
choose_other_label
Given a cardinality k and true label y, return random value in {1,...,k} \ {y}.
synthetic/generate.py
def choose_other_label(k, y): """Given a cardinality k and true label y, return random value in {1,...,k} \ {y}.""" return choice(list(set(range(1, k + 1)) - set([y])))
def choose_other_label(k, y): """Given a cardinality k and true label y, return random value in {1,...,k} \ {y}.""" return choice(list(set(range(1, k + 1)) - set([y])))
[ "Given", "a", "cardinality", "k", "and", "true", "label", "y", "return", "random", "value", "in", "{", "1", "...", "k", "}", "\\", "{", "y", "}", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L34-L37
[ "def", "choose_other_label", "(", "k", ",", "y", ")", ":", "return", "choice", "(", "list", "(", "set", "(", "range", "(", "1", ",", "k", "+", "1", ")", ")", "-", "set", "(", "[", "y", "]", ")", ")", ")" ]
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
gaussian_bags_of_words
Generate Gaussian bags of words based on label assignments Args: Y: np.array of true labels sigma: (float) the standard deviation of the Gaussian distributions bag_size: (list) the min and max length of bags of words Returns: X: (Tensor) a tensor of indices representing tokens ...
synthetic/generate.py
def gaussian_bags_of_words(Y, vocab=vocab1k, sigma=1, bag_size=[25, 50], **kwargs): """ Generate Gaussian bags of words based on label assignments Args: Y: np.array of true labels sigma: (float) the standard deviation of the Gaussian distributions bag_size: (list) the min and max le...
def gaussian_bags_of_words(Y, vocab=vocab1k, sigma=1, bag_size=[25, 50], **kwargs): """ Generate Gaussian bags of words based on label assignments Args: Y: np.array of true labels sigma: (float) the standard deviation of the Gaussian distributions bag_size: (list) the min and max le...
[ "Generate", "Gaussian", "bags", "of", "words", "based", "on", "label", "assignments" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L232-L269
[ "def", "gaussian_bags_of_words", "(", "Y", ",", "vocab", "=", "vocab1k", ",", "sigma", "=", "1", ",", "bag_size", "=", "[", "25", ",", "50", "]", ",", "*", "*", "kwargs", ")", ":", "def", "make_distribution", "(", "sigma", ",", "num_words", ")", ":",...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
SingleTaskTreeDepsGenerator._generate_edges
Generate a random tree-structured dependency graph based on a specified edge probability. Also create helper data struct mapping child -> parent.
synthetic/generate.py
def _generate_edges(self, edge_prob): """Generate a random tree-structured dependency graph based on a specified edge probability. Also create helper data struct mapping child -> parent. """ self.E, self.parent = [], {} for i in range(self.m): if random() < e...
def _generate_edges(self, edge_prob): """Generate a random tree-structured dependency graph based on a specified edge probability. Also create helper data struct mapping child -> parent. """ self.E, self.parent = [], {} for i in range(self.m): if random() < e...
[ "Generate", "a", "random", "tree", "-", "structured", "dependency", "graph", "based", "on", "a", "specified", "edge", "probability", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L107-L118
[ "def", "_generate_edges", "(", "self", ",", "edge_prob", ")", ":", "self", ".", "E", ",", "self", ".", "parent", "=", "[", "]", ",", "{", "}", "for", "i", "in", "range", "(", "self", ".", "m", ")", ":", "if", "random", "(", ")", "<", "edge_prob...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
SingleTaskTreeDepsGenerator.P_conditional
Compute the conditional probability P_\theta(li | lj, y) = Z^{-1} exp( theta_{i|y} \indpm{ \lambda_i = Y } + \theta_{i,j} \indpm{ \lambda_i = \lambda_j } ) In other words, compute the conditional probability that LF i outputs ...
synthetic/generate.py
def P_conditional(self, i, li, j, lj, y): """Compute the conditional probability P_\theta(li | lj, y) = Z^{-1} exp( theta_{i|y} \indpm{ \lambda_i = Y } + \theta_{i,j} \indpm{ \lambda_i = \lambda_j } ) In other words, compute...
def P_conditional(self, i, li, j, lj, y): """Compute the conditional probability P_\theta(li | lj, y) = Z^{-1} exp( theta_{i|y} \indpm{ \lambda_i = Y } + \theta_{i,j} \indpm{ \lambda_i = \lambda_j } ) In other words, compute...
[ "Compute", "the", "conditional", "probability", "P_", "\\", "theta", "(", "li", "|", "lj", "y", ")", "=", "Z^", "{", "-", "1", "}", "exp", "(", "theta_", "{", "i|y", "}", "\\", "indpm", "{", "\\", "lambda_i", "=", "Y", "}", "+", "\\", "theta_", ...
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L138-L152
[ "def", "P_conditional", "(", "self", ",", "i", ",", "li", ",", "j", ",", "lj", ",", "y", ")", ":", "Z", "=", "np", ".", "sum", "(", "[", "self", ".", "_P", "(", "i", ",", "_li", ",", "j", ",", "lj", ",", "y", ")", "for", "_li", "in", "r...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
SingleTaskTreeDepsGenerator._generate_label_matrix
Generate an [n,m] label matrix with entries in {0,...,k}
synthetic/generate.py
def _generate_label_matrix(self): """Generate an [n,m] label matrix with entries in {0,...,k}""" self.L = np.zeros((self.n, self.m)) self.Y = np.zeros(self.n, dtype=np.int64) for i in range(self.n): y = choice(self.k, p=self.p) + 1 # Note that y \in {1,...,k} sel...
def _generate_label_matrix(self): """Generate an [n,m] label matrix with entries in {0,...,k}""" self.L = np.zeros((self.n, self.m)) self.Y = np.zeros(self.n, dtype=np.int64) for i in range(self.n): y = choice(self.k, p=self.p) + 1 # Note that y \in {1,...,k} sel...
[ "Generate", "an", "[", "n", "m", "]", "label", "matrix", "with", "entries", "in", "{", "0", "...", "k", "}" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L154-L168
[ "def", "_generate_label_matrix", "(", "self", ")", ":", "self", ".", "L", "=", "np", ".", "zeros", "(", "(", "self", ".", "n", ",", "self", ".", "m", ")", ")", "self", ".", "Y", "=", "np", ".", "zeros", "(", "self", ".", "n", ",", "dtype", "=...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
SingleTaskTreeDepsGenerator._get_conditional_probs
Compute the true clique conditional probabilities P(\lC | Y) by counting given L, Y; we'll use this as ground truth to compare to. Note that this generates an attribute, self.c_probs, that has the same definition as returned by `LabelModel.get_conditional_probs`. TODO: Can compute thes...
synthetic/generate.py
def _get_conditional_probs(self): """Compute the true clique conditional probabilities P(\lC | Y) by counting given L, Y; we'll use this as ground truth to compare to. Note that this generates an attribute, self.c_probs, that has the same definition as returned by `LabelModel.get_condit...
def _get_conditional_probs(self): """Compute the true clique conditional probabilities P(\lC | Y) by counting given L, Y; we'll use this as ground truth to compare to. Note that this generates an attribute, self.c_probs, that has the same definition as returned by `LabelModel.get_condit...
[ "Compute", "the", "true", "clique", "conditional", "probabilities", "P", "(", "\\", "lC", "|", "Y", ")", "by", "counting", "given", "L", "Y", ";", "we", "ll", "use", "this", "as", "ground", "truth", "to", "compare", "to", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/synthetic/generate.py#L170-L186
[ "def", "_get_conditional_probs", "(", "self", ")", ":", "# TODO: Extend to higher-order cliques again", "self", ".", "c_probs", "=", "np", ".", "zeros", "(", "(", "self", ".", "m", "*", "(", "self", ".", "k", "+", "1", ")", ",", "self", ".", "k", ")", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
Featurizer.fit_transform
Execute fit and transform in sequence.
metal/contrib/featurizers/featurizer.py
def fit_transform(self, input, **fit_kwargs): """Execute fit and transform in sequence.""" self.fit(input, **fit_kwargs) X = self.transform(input) return X
def fit_transform(self, input, **fit_kwargs): """Execute fit and transform in sequence.""" self.fit(input, **fit_kwargs) X = self.transform(input) return X
[ "Execute", "fit", "and", "transform", "in", "sequence", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/featurizers/featurizer.py#L20-L24
[ "def", "fit_transform", "(", "self", ",", "input", ",", "*", "*", "fit_kwargs", ")", ":", "self", ".", "fit", "(", "input", ",", "*", "*", "fit_kwargs", ")", "X", "=", "self", ".", "transform", "(", "input", ")", "return", "X" ]
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
EmbeddingFeaturizer.fit
Builds a vocabulary object based on the tokens in the input. Args: sents: A list of lists of tokens (representing sentences) Vocab kwargs include: max_size min_freq specials unk_init
metal/contrib/featurizers/embedding_featurizer.py
def fit(self, sents, **kwargs): """Builds a vocabulary object based on the tokens in the input. Args: sents: A list of lists of tokens (representing sentences) Vocab kwargs include: max_size min_freq specials unk_init """ ...
def fit(self, sents, **kwargs): """Builds a vocabulary object based on the tokens in the input. Args: sents: A list of lists of tokens (representing sentences) Vocab kwargs include: max_size min_freq specials unk_init """ ...
[ "Builds", "a", "vocabulary", "object", "based", "on", "the", "tokens", "in", "the", "input", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/featurizers/embedding_featurizer.py#L21-L35
[ "def", "fit", "(", "self", ",", "sents", ",", "*", "*", "kwargs", ")", ":", "tokens", "=", "list", "(", "itertools", ".", "chain", ".", "from_iterable", "(", "sents", ")", ")", "counter", "=", "Counter", "(", "tokens", ")", "self", ".", "vocab", "=...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
EmbeddingFeaturizer.transform
Converts lists of tokens into a Tensor of embedding indices. Args: sents: A list of lists of tokens (representing sentences) NOTE: These sentences should already be marked using the mark_entities() helper. Returns: X: A Tensor of shape (num_items,...
metal/contrib/featurizers/embedding_featurizer.py
def transform(self, sents): """Converts lists of tokens into a Tensor of embedding indices. Args: sents: A list of lists of tokens (representing sentences) NOTE: These sentences should already be marked using the mark_entities() helper. Returns: ...
def transform(self, sents): """Converts lists of tokens into a Tensor of embedding indices. Args: sents: A list of lists of tokens (representing sentences) NOTE: These sentences should already be marked using the mark_entities() helper. Returns: ...
[ "Converts", "lists", "of", "tokens", "into", "a", "Tensor", "of", "embedding", "indices", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/contrib/featurizers/embedding_featurizer.py#L37-L58
[ "def", "transform", "(", "self", ",", "sents", ")", ":", "def", "convert", "(", "tokens", ")", ":", "return", "torch", ".", "tensor", "(", "[", "self", ".", "vocab", ".", "stoi", "[", "t", "]", "for", "t", "in", "tokens", "]", ",", "dtype", "=", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
rargmax
Argmax with random tie-breaking Args: x: a 1-dim numpy array Returns: the argmax index
metal/utils.py
def rargmax(x, eps=1e-8): """Argmax with random tie-breaking Args: x: a 1-dim numpy array Returns: the argmax index """ idxs = np.where(abs(x - np.max(x, axis=0)) < eps)[0] return np.random.choice(idxs)
def rargmax(x, eps=1e-8): """Argmax with random tie-breaking Args: x: a 1-dim numpy array Returns: the argmax index """ idxs = np.where(abs(x - np.max(x, axis=0)) < eps)[0] return np.random.choice(idxs)
[ "Argmax", "with", "random", "tie", "-", "breaking" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L32-L41
[ "def", "rargmax", "(", "x", ",", "eps", "=", "1e-8", ")", ":", "idxs", "=", "np", ".", "where", "(", "abs", "(", "x", "-", "np", ".", "max", "(", "x", ",", "axis", "=", "0", ")", ")", "<", "eps", ")", "[", "0", "]", "return", "np", ".", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
pred_to_prob
Converts a 1D tensor of predicted labels into a 2D tensor of probabilistic labels Args: Y_h: an [n], or [n,1] tensor of predicted (int) labels in {1,...,k} k: the largest possible label in Y_h Returns: Y_s: a torch.FloatTensor of shape [n, k] where Y_s[i, j-1] is the probabilistic ...
metal/utils.py
def pred_to_prob(Y_h, k): """Converts a 1D tensor of predicted labels into a 2D tensor of probabilistic labels Args: Y_h: an [n], or [n,1] tensor of predicted (int) labels in {1,...,k} k: the largest possible label in Y_h Returns: Y_s: a torch.FloatTensor of shape [n, k] where Y_s[i...
def pred_to_prob(Y_h, k): """Converts a 1D tensor of predicted labels into a 2D tensor of probabilistic labels Args: Y_h: an [n], or [n,1] tensor of predicted (int) labels in {1,...,k} k: the largest possible label in Y_h Returns: Y_s: a torch.FloatTensor of shape [n, k] where Y_s[i...
[ "Converts", "a", "1D", "tensor", "of", "predicted", "labels", "into", "a", "2D", "tensor", "of", "probabilistic", "labels" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L44-L64
[ "def", "pred_to_prob", "(", "Y_h", ",", "k", ")", ":", "Y_h", "=", "Y_h", ".", "clone", "(", ")", "if", "Y_h", ".", "dim", "(", ")", ">", "1", ":", "Y_h", "=", "Y_h", ".", "squeeze", "(", ")", "assert", "Y_h", ".", "dim", "(", ")", "==", "1...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
arraylike_to_numpy
Convert a 1d array-like (e.g,. list, tensor, etc.) to an np.ndarray
metal/utils.py
def arraylike_to_numpy(array_like): """Convert a 1d array-like (e.g,. list, tensor, etc.) to an np.ndarray""" orig_type = type(array_like) # Convert to np.ndarray if isinstance(array_like, np.ndarray): pass elif isinstance(array_like, list): array_like = np.array(array_like) el...
def arraylike_to_numpy(array_like): """Convert a 1d array-like (e.g,. list, tensor, etc.) to an np.ndarray""" orig_type = type(array_like) # Convert to np.ndarray if isinstance(array_like, np.ndarray): pass elif isinstance(array_like, list): array_like = np.array(array_like) el...
[ "Convert", "a", "1d", "array", "-", "like", "(", "e", ".", "g", ".", "list", "tensor", "etc", ".", ")", "to", "an", "np", ".", "ndarray" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L67-L98
[ "def", "arraylike_to_numpy", "(", "array_like", ")", ":", "orig_type", "=", "type", "(", "array_like", ")", "# Convert to np.ndarray", "if", "isinstance", "(", "array_like", ",", "np", ".", "ndarray", ")", ":", "pass", "elif", "isinstance", "(", "array_like", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
convert_labels
Convert a matrix from one label type to another Args: Y: A np.ndarray or torch.Tensor of labels (ints) source: The convention the labels are currently expressed in dest: The convention to convert the labels to Conventions: 'categorical': [0: abstain, 1: positive, 2: negative] ...
metal/utils.py
def convert_labels(Y, source, dest): """Convert a matrix from one label type to another Args: Y: A np.ndarray or torch.Tensor of labels (ints) source: The convention the labels are currently expressed in dest: The convention to convert the labels to Conventions: 'categorica...
def convert_labels(Y, source, dest): """Convert a matrix from one label type to another Args: Y: A np.ndarray or torch.Tensor of labels (ints) source: The convention the labels are currently expressed in dest: The convention to convert the labels to Conventions: 'categorica...
[ "Convert", "a", "matrix", "from", "one", "label", "type", "to", "another" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L101-L128
[ "def", "convert_labels", "(", "Y", ",", "source", ",", "dest", ")", ":", "if", "Y", "is", "None", ":", "return", "Y", "if", "isinstance", "(", "Y", ",", "np", ".", "ndarray", ")", ":", "Y", "=", "Y", ".", "copy", "(", ")", "assert", "isinstance",...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
label_matrix_to_one_hot
Converts a 2D [n,m] label matrix into an [n,m,k] one hot 3D tensor Note that in the returned 3D matrix, abstain votes continue to be represented by 0s, not 1s. Args: L: a [n,m] label matrix with categorical labels (0 = abstain) k: the number of classes that could appear in L if...
metal/utils.py
def label_matrix_to_one_hot(L, k=None): """Converts a 2D [n,m] label matrix into an [n,m,k] one hot 3D tensor Note that in the returned 3D matrix, abstain votes continue to be represented by 0s, not 1s. Args: L: a [n,m] label matrix with categorical labels (0 = abstain) k: the number o...
def label_matrix_to_one_hot(L, k=None): """Converts a 2D [n,m] label matrix into an [n,m,k] one hot 3D tensor Note that in the returned 3D matrix, abstain votes continue to be represented by 0s, not 1s. Args: L: a [n,m] label matrix with categorical labels (0 = abstain) k: the number o...
[ "Converts", "a", "2D", "[", "n", "m", "]", "label", "matrix", "into", "an", "[", "n", "m", "k", "]", "one", "hot", "3D", "tensor" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L139-L158
[ "def", "label_matrix_to_one_hot", "(", "L", ",", "k", "=", "None", ")", ":", "n", ",", "m", "=", "L", ".", "shape", "if", "k", "is", "None", ":", "k", "=", "L", ".", "max", "(", ")", "L_onehot", "=", "torch", ".", "zeros", "(", "n", ",", "m",...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
recursive_merge_dicts
Merge dictionary y into a copy of x, overwriting elements of x when there is a conflict, except if the element is a dictionary, in which case recurse. misses: what to do if a key in y is not in x 'insert' -> set x[key] = value 'exception' -> raise an exception 'report' -> report t...
metal/utils.py
def recursive_merge_dicts(x, y, misses="report", verbose=None): """ Merge dictionary y into a copy of x, overwriting elements of x when there is a conflict, except if the element is a dictionary, in which case recurse. misses: what to do if a key in y is not in x 'insert' -> set x[key] = val...
def recursive_merge_dicts(x, y, misses="report", verbose=None): """ Merge dictionary y into a copy of x, overwriting elements of x when there is a conflict, except if the element is a dictionary, in which case recurse. misses: what to do if a key in y is not in x 'insert' -> set x[key] = val...
[ "Merge", "dictionary", "y", "into", "a", "copy", "of", "x", "overwriting", "elements", "of", "x", "when", "there", "is", "a", "conflict", "except", "if", "the", "element", "is", "a", "dictionary", "in", "which", "case", "recurse", "." ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L161-L221
[ "def", "recursive_merge_dicts", "(", "x", ",", "y", ",", "misses", "=", "\"report\"", ",", "verbose", "=", "None", ")", ":", "def", "recurse", "(", "x", ",", "y", ",", "misses", "=", "\"report\"", ",", "verbose", "=", "1", ")", ":", "found", "=", "...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
split_data
Splits inputs into multiple splits of defined sizes Args: inputs: correlated tuples/lists/arrays/matrices/tensors to split splits: list containing split sizes (fractions or counts); shuffle: if True, shuffle the data before splitting stratify_by: (None or an input) if not None, use ...
metal/utils.py
def split_data( *inputs, splits=[0.5, 0.5], shuffle=True, stratify_by=None, index_only=False, seed=None, ): """Splits inputs into multiple splits of defined sizes Args: inputs: correlated tuples/lists/arrays/matrices/tensors to split splits: list containing split sizes (...
def split_data( *inputs, splits=[0.5, 0.5], shuffle=True, stratify_by=None, index_only=False, seed=None, ): """Splits inputs into multiple splits of defined sizes Args: inputs: correlated tuples/lists/arrays/matrices/tensors to split splits: list containing split sizes (...
[ "Splits", "inputs", "into", "multiple", "splits", "of", "defined", "sizes" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L233-L345
[ "def", "split_data", "(", "*", "inputs", ",", "splits", "=", "[", "0.5", ",", "0.5", "]", ",", "shuffle", "=", "True", ",", "stratify_by", "=", "None", ",", "index_only", "=", "False", ",", "seed", "=", "None", ",", ")", ":", "def", "fractions_to_cou...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
place_on_gpu
Utility to place data on GPU, where data could be a torch.Tensor, a tuple or list of Tensors, or a tuple or list of tuple or lists of Tensors
metal/utils.py
def place_on_gpu(data): """Utility to place data on GPU, where data could be a torch.Tensor, a tuple or list of Tensors, or a tuple or list of tuple or lists of Tensors""" data_type = type(data) if data_type in (list, tuple): data = [place_on_gpu(data[i]) for i in range(len(data))] data ...
def place_on_gpu(data): """Utility to place data on GPU, where data could be a torch.Tensor, a tuple or list of Tensors, or a tuple or list of tuple or lists of Tensors""" data_type = type(data) if data_type in (list, tuple): data = [place_on_gpu(data[i]) for i in range(len(data))] data ...
[ "Utility", "to", "place", "data", "on", "GPU", "where", "data", "could", "be", "a", "torch", ".", "Tensor", "a", "tuple", "or", "list", "of", "Tensors", "or", "a", "tuple", "or", "list", "of", "tuple", "or", "lists", "of", "Tensors" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/utils.py#L348-L359
[ "def", "place_on_gpu", "(", "data", ")", ":", "data_type", "=", "type", "(", "data", ")", "if", "data_type", "in", "(", "list", ",", "tuple", ")", ":", "data", "=", "[", "place_on_gpu", "(", "data", "[", "i", "]", ")", "for", "i", "in", "range", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTEndModel._build
TBD
metal/multitask/mt_end_model.py
def _build(self, input_modules, middle_modules, head_modules): """ TBD """ self.input_layer = self._build_input_layer(input_modules) self.middle_layers = self._build_middle_layers(middle_modules) self.heads = self._build_task_heads(head_modules) # Construct loss ...
def _build(self, input_modules, middle_modules, head_modules): """ TBD """ self.input_layer = self._build_input_layer(input_modules) self.middle_layers = self._build_middle_layers(middle_modules) self.heads = self._build_task_heads(head_modules) # Construct loss ...
[ "TBD" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_end_model.py#L87-L97
[ "def", "_build", "(", "self", ",", "input_modules", ",", "middle_modules", ",", "head_modules", ")", ":", "self", ".", "input_layer", "=", "self", ".", "_build_input_layer", "(", "input_modules", ")", "self", ".", "middle_layers", "=", "self", ".", "_build_mid...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTEndModel._build_task_heads
Creates and attaches task_heads to the appropriate network layers
metal/multitask/mt_end_model.py
def _build_task_heads(self, head_modules): """Creates and attaches task_heads to the appropriate network layers""" # Make task head layer assignments num_layers = len(self.config["layer_out_dims"]) task_head_layers = self._set_task_head_layers(num_layers) # task_head_layers stor...
def _build_task_heads(self, head_modules): """Creates and attaches task_heads to the appropriate network layers""" # Make task head layer assignments num_layers = len(self.config["layer_out_dims"]) task_head_layers = self._set_task_head_layers(num_layers) # task_head_layers stor...
[ "Creates", "and", "attaches", "task_heads", "to", "the", "appropriate", "network", "layers" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_end_model.py#L143-L181
[ "def", "_build_task_heads", "(", "self", ",", "head_modules", ")", ":", "# Make task head layer assignments", "num_layers", "=", "len", "(", "self", ".", "config", "[", "\"layer_out_dims\"", "]", ")", "task_head_layers", "=", "self", ".", "_set_task_head_layers", "(...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTEndModel.forward
Returns a list of outputs for tasks 0,...t-1 Args: x: a [batch_size, ...] batch from X
metal/multitask/mt_end_model.py
def forward(self, x): """Returns a list of outputs for tasks 0,...t-1 Args: x: a [batch_size, ...] batch from X """ head_outputs = [None] * self.t # Execute input layer if isinstance(self.input_layer, list): # One input_module per task input_out...
def forward(self, x): """Returns a list of outputs for tasks 0,...t-1 Args: x: a [batch_size, ...] batch from X """ head_outputs = [None] * self.t # Execute input layer if isinstance(self.input_layer, list): # One input_module per task input_out...
[ "Returns", "a", "list", "of", "outputs", "for", "tasks", "0", "...", "t", "-", "1" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_end_model.py#L238-L279
[ "def", "forward", "(", "self", ",", "x", ")", ":", "head_outputs", "=", "[", "None", "]", "*", "self", ".", "t", "# Execute input layer", "if", "isinstance", "(", "self", ".", "input_layer", ",", "list", ")", ":", "# One input_module per task", "input_output...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTEndModel._preprocess_Y
Convert Y to t-length list of probabilistic labels if necessary
metal/multitask/mt_end_model.py
def _preprocess_Y(self, Y, k=None): """Convert Y to t-length list of probabilistic labels if necessary""" # If not a list, convert to a singleton list if not isinstance(Y, list): if self.t != 1: msg = "For t > 1, Y must be a list of n-dim or [n, K_t] tensors" ...
def _preprocess_Y(self, Y, k=None): """Convert Y to t-length list of probabilistic labels if necessary""" # If not a list, convert to a singleton list if not isinstance(Y, list): if self.t != 1: msg = "For t > 1, Y must be a list of n-dim or [n, K_t] tensors" ...
[ "Convert", "Y", "to", "t", "-", "length", "list", "of", "probabilistic", "labels", "if", "necessary" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_end_model.py#L281-L294
[ "def", "_preprocess_Y", "(", "self", ",", "Y", ",", "k", "=", "None", ")", ":", "# If not a list, convert to a singleton list", "if", "not", "isinstance", "(", "Y", ",", "list", ")", ":", "if", "self", ".", "t", "!=", "1", ":", "msg", "=", "\"For t > 1, ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTEndModel._get_loss_fn
Returns the loss function to use in the train_model routine
metal/multitask/mt_end_model.py
def _get_loss_fn(self): """Returns the loss function to use in the train_model routine""" criteria = self.criteria.to(self.config["device"]) loss_fn = lambda X, Y: sum( criteria(Y_tp, Y_t) for Y_tp, Y_t in zip(self.forward(X), Y) ) return loss_fn
def _get_loss_fn(self): """Returns the loss function to use in the train_model routine""" criteria = self.criteria.to(self.config["device"]) loss_fn = lambda X, Y: sum( criteria(Y_tp, Y_t) for Y_tp, Y_t in zip(self.forward(X), Y) ) return loss_fn
[ "Returns", "the", "loss", "function", "to", "use", "in", "the", "train_model", "routine" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_end_model.py#L296-L302
[ "def", "_get_loss_fn", "(", "self", ")", ":", "criteria", "=", "self", ".", "criteria", ".", "to", "(", "self", ".", "config", "[", "\"device\"", "]", ")", "loss_fn", "=", "lambda", "X", ",", "Y", ":", "sum", "(", "criteria", "(", "Y_tp", ",", "Y_t...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTLabelModel._create_L_ind
Convert T label matrices with labels in 0...K_t to a one-hot format Here we can view e.g. the $(i,j)$ entries of the $T$ label matrices as a _label vector_ emitted by LF j for data point i. Args: L: a T-length list of [n,m] scipy.sparse label matrices with values in...
metal/multitask/mt_label_model.py
def _create_L_ind(self, L): """Convert T label matrices with labels in 0...K_t to a one-hot format Here we can view e.g. the $(i,j)$ entries of the $T$ label matrices as a _label vector_ emitted by LF j for data point i. Args: L: a T-length list of [n,m] scipy.sparse label ...
def _create_L_ind(self, L): """Convert T label matrices with labels in 0...K_t to a one-hot format Here we can view e.g. the $(i,j)$ entries of the $T$ label matrices as a _label vector_ emitted by LF j for data point i. Args: L: a T-length list of [n,m] scipy.sparse label ...
[ "Convert", "T", "label", "matrices", "with", "labels", "in", "0", "...", "K_t", "to", "a", "one", "-", "hot", "format" ]
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_label_model.py#L47-L82
[ "def", "_create_L_ind", "(", "self", ",", "L", ")", ":", "# TODO: Update LabelModel to keep L, L_ind, L_aug as sparse matrices", "# throughout and remove this line.", "if", "issparse", "(", "L", "[", "0", "]", ")", ":", "L", "=", "[", "L_t", ".", "todense", "(", "...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a
train
MTLabelModel.predict_proba
Returns the task marginals estimated by the model: a t-length list of [n,k_t] matrices where the (i,j) entry of the sth matrix represents the estimated P((Y_i)_s | \lambda_j(x_i)) Args: L: A t-length list of [n,m] scipy.sparse label matrices with values in {0,1,...,k...
metal/multitask/mt_label_model.py
def predict_proba(self, L): """Returns the task marginals estimated by the model: a t-length list of [n,k_t] matrices where the (i,j) entry of the sth matrix represents the estimated P((Y_i)_s | \lambda_j(x_i)) Args: L: A t-length list of [n,m] scipy.sparse label matrices wi...
def predict_proba(self, L): """Returns the task marginals estimated by the model: a t-length list of [n,k_t] matrices where the (i,j) entry of the sth matrix represents the estimated P((Y_i)_s | \lambda_j(x_i)) Args: L: A t-length list of [n,m] scipy.sparse label matrices wi...
[ "Returns", "the", "task", "marginals", "estimated", "by", "the", "model", ":", "a", "t", "-", "length", "list", "of", "[", "n", "k_t", "]", "matrices", "where", "the", "(", "i", "j", ")", "entry", "of", "the", "sth", "matrix", "represents", "the", "e...
HazyResearch/metal
python
https://github.com/HazyResearch/metal/blob/c24e3772e25ac6d0917b8b7af4c1bcb92928f84a/metal/multitask/mt_label_model.py#L84-L106
[ "def", "predict_proba", "(", "self", ",", "L", ")", ":", "# First, get the estimated probability distribution over the feasible", "# set defined by the TaskGraph", "# This is an [n,k] array, where k = |(feasible set)|", "Y_pf", "=", "LabelModel", ".", "predict_proba", "(", "self", ...
c24e3772e25ac6d0917b8b7af4c1bcb92928f84a