repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager._apply_func_to_list_of_partitions
def _apply_func_to_list_of_partitions(self, func, partitions, **kwargs): """Applies a function to a list of remote partitions. Note: The main use for this is to preprocess the func. Args: func: The func to apply partitions: The list of partitions Returns: ...
python
def _apply_func_to_list_of_partitions(self, func, partitions, **kwargs): """Applies a function to a list of remote partitions. Note: The main use for this is to preprocess the func. Args: func: The func to apply partitions: The list of partitions Returns: ...
[ "def", "_apply_func_to_list_of_partitions", "(", "self", ",", "func", ",", "partitions", ",", "*", "*", "kwargs", ")", ":", "preprocessed_func", "=", "self", ".", "preprocess_func", "(", "func", ")", "return", "[", "obj", ".", "apply", "(", "preprocessed_func"...
Applies a function to a list of remote partitions. Note: The main use for this is to preprocess the func. Args: func: The func to apply partitions: The list of partitions Returns: A list of BaseFramePartition objects.
[ "Applies", "a", "function", "to", "a", "list", "of", "remote", "partitions", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L670-L683
train
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager.apply_func_to_select_indices
def apply_func_to_select_indices(self, axis, func, indices, keep_remaining=False): """Applies a function to select indices. Note: Your internal function must take a kwarg `internal_indices` for this to work correctly. This prevents information leakage of the internal index to th...
python
def apply_func_to_select_indices(self, axis, func, indices, keep_remaining=False): """Applies a function to select indices. Note: Your internal function must take a kwarg `internal_indices` for this to work correctly. This prevents information leakage of the internal index to th...
[ "def", "apply_func_to_select_indices", "(", "self", ",", "axis", ",", "func", ",", "indices", ",", "keep_remaining", "=", "False", ")", ":", "if", "self", ".", "partitions", ".", "size", "==", "0", ":", "return", "np", ".", "array", "(", "[", "[", "]",...
Applies a function to select indices. Note: Your internal function must take a kwarg `internal_indices` for this to work correctly. This prevents information leakage of the internal index to the external representation. Args: axis: The axis to apply the func over. ...
[ "Applies", "a", "function", "to", "select", "indices", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L685-L803
train
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager.apply_func_to_select_indices_along_full_axis
def apply_func_to_select_indices_along_full_axis( self, axis, func, indices, keep_remaining=False ): """Applies a function to a select subset of full columns/rows. Note: This should be used when you need to apply a function that relies on some global information for the entire c...
python
def apply_func_to_select_indices_along_full_axis( self, axis, func, indices, keep_remaining=False ): """Applies a function to a select subset of full columns/rows. Note: This should be used when you need to apply a function that relies on some global information for the entire c...
[ "def", "apply_func_to_select_indices_along_full_axis", "(", "self", ",", "axis", ",", "func", ",", "indices", ",", "keep_remaining", "=", "False", ")", ":", "if", "self", ".", "partitions", ".", "size", "==", "0", ":", "return", "self", ".", "__constructor__",...
Applies a function to a select subset of full columns/rows. Note: This should be used when you need to apply a function that relies on some global information for the entire column/row, but only need to apply a function to a subset. Important: For your func to operate directly ...
[ "Applies", "a", "function", "to", "a", "select", "subset", "of", "full", "columns", "/", "rows", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L805-L905
train
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager.apply_func_to_indices_both_axis
def apply_func_to_indices_both_axis( self, func, row_indices, col_indices, lazy=False, keep_remaining=True, mutate=False, item_to_distribute=None, ): """ Apply a function to along both axis Important: For your func to operate d...
python
def apply_func_to_indices_both_axis( self, func, row_indices, col_indices, lazy=False, keep_remaining=True, mutate=False, item_to_distribute=None, ): """ Apply a function to along both axis Important: For your func to operate d...
[ "def", "apply_func_to_indices_both_axis", "(", "self", ",", "func", ",", "row_indices", ",", "col_indices", ",", "lazy", "=", "False", ",", "keep_remaining", "=", "True", ",", "mutate", "=", "False", ",", "item_to_distribute", "=", "None", ",", ")", ":", "if...
Apply a function to along both axis Important: For your func to operate directly on the indices provided, it must use `row_internal_indices, col_internal_indices` as keyword arguments.
[ "Apply", "a", "function", "to", "along", "both", "axis" ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L907-L987
train
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager.inter_data_operation
def inter_data_operation(self, axis, func, other): """Apply a function that requires two BaseFrameManager objects. Args: axis: The axis to apply the function over (0 - rows, 1 - columns) func: The function to apply other: The other BaseFrameManager object to apply fu...
python
def inter_data_operation(self, axis, func, other): """Apply a function that requires two BaseFrameManager objects. Args: axis: The axis to apply the function over (0 - rows, 1 - columns) func: The function to apply other: The other BaseFrameManager object to apply fu...
[ "def", "inter_data_operation", "(", "self", ",", "axis", ",", "func", ",", "other", ")", ":", "if", "axis", ":", "partitions", "=", "self", ".", "row_partitions", "other_partitions", "=", "other", ".", "row_partitions", "else", ":", "partitions", "=", "self"...
Apply a function that requires two BaseFrameManager objects. Args: axis: The axis to apply the function over (0 - rows, 1 - columns) func: The function to apply other: The other BaseFrameManager object to apply func to. Returns: A new BaseFrameManager ob...
[ "Apply", "a", "function", "that", "requires", "two", "BaseFrameManager", "objects", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L989-L1017
train
modin-project/modin
modin/engines/base/frame/partition_manager.py
BaseFrameManager.manual_shuffle
def manual_shuffle(self, axis, shuffle_func, lengths): """Shuffle the partitions based on the `shuffle_func`. Args: axis: The axis to shuffle across. shuffle_func: The function to apply before splitting the result. lengths: The length of each partition to split the r...
python
def manual_shuffle(self, axis, shuffle_func, lengths): """Shuffle the partitions based on the `shuffle_func`. Args: axis: The axis to shuffle across. shuffle_func: The function to apply before splitting the result. lengths: The length of each partition to split the r...
[ "def", "manual_shuffle", "(", "self", ",", "axis", ",", "shuffle_func", ",", "lengths", ")", ":", "if", "axis", ":", "partitions", "=", "self", ".", "row_partitions", "else", ":", "partitions", "=", "self", ".", "column_partitions", "func", "=", "self", "....
Shuffle the partitions based on the `shuffle_func`. Args: axis: The axis to shuffle across. shuffle_func: The function to apply before splitting the result. lengths: The length of each partition to split the result into. Returns: A new BaseFrameManager ...
[ "Shuffle", "the", "partitions", "based", "on", "the", "shuffle_func", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/frame/partition_manager.py#L1019-L1036
train
modin-project/modin
modin/pandas/io.py
read_parquet
def read_parquet(path, engine="auto", columns=None, **kwargs): """Load a parquet object from the file path, returning a DataFrame. Args: path: The filepath of the parquet file. We only support local files for now. engine: This argument doesn't do anything for now. kwargs: ...
python
def read_parquet(path, engine="auto", columns=None, **kwargs): """Load a parquet object from the file path, returning a DataFrame. Args: path: The filepath of the parquet file. We only support local files for now. engine: This argument doesn't do anything for now. kwargs: ...
[ "def", "read_parquet", "(", "path", ",", "engine", "=", "\"auto\"", ",", "columns", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "DataFrame", "(", "query_compiler", "=", "BaseFactory", ".", "read_parquet", "(", "path", "=", "path", ",", "col...
Load a parquet object from the file path, returning a DataFrame. Args: path: The filepath of the parquet file. We only support local files for now. engine: This argument doesn't do anything for now. kwargs: Pass into parquet's read_pandas function.
[ "Load", "a", "parquet", "object", "from", "the", "file", "path", "returning", "a", "DataFrame", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L18-L31
train
modin-project/modin
modin/pandas/io.py
_make_parser_func
def _make_parser_func(sep): """Creates a parser function from the given sep. Args: sep: The separator default to use for the parser. Returns: A function object. """ def parser_func( filepath_or_buffer, sep=sep, delimiter=None, header="infer", ...
python
def _make_parser_func(sep): """Creates a parser function from the given sep. Args: sep: The separator default to use for the parser. Returns: A function object. """ def parser_func( filepath_or_buffer, sep=sep, delimiter=None, header="infer", ...
[ "def", "_make_parser_func", "(", "sep", ")", ":", "def", "parser_func", "(", "filepath_or_buffer", ",", "sep", "=", "sep", ",", "delimiter", "=", "None", ",", "header", "=", "\"infer\"", ",", "names", "=", "None", ",", "index_col", "=", "None", ",", "use...
Creates a parser function from the given sep. Args: sep: The separator default to use for the parser. Returns: A function object.
[ "Creates", "a", "parser", "function", "from", "the", "given", "sep", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L35-L101
train
modin-project/modin
modin/pandas/io.py
_read
def _read(**kwargs): """Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv """ pd_obj = BaseFactory.read_csv(**kwargs) # This happens when...
python
def _read(**kwargs): """Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv """ pd_obj = BaseFactory.read_csv(**kwargs) # This happens when...
[ "def", "_read", "(", "*", "*", "kwargs", ")", ":", "pd_obj", "=", "BaseFactory", ".", "read_csv", "(", "*", "*", "kwargs", ")", "# This happens when `read_csv` returns a TextFileReader object for iterating through", "if", "isinstance", "(", "pd_obj", ",", "pandas", ...
Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv
[ "Read", "csv", "file", "from", "local", "disk", ".", "Args", ":", "filepath_or_buffer", ":", "The", "filepath", "of", "the", "csv", "file", ".", "We", "only", "support", "local", "files", "for", "now", ".", "kwargs", ":", "Keyword", "arguments", "in", "p...
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L104-L120
train
modin-project/modin
modin/pandas/io.py
read_sql
def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize=None, ): """ Read SQL query or database table into a DataFrame. Args: sql: string or SQLAlchemy Selectable (select or text object) SQL query to be executed o...
python
def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize=None, ): """ Read SQL query or database table into a DataFrame. Args: sql: string or SQLAlchemy Selectable (select or text object) SQL query to be executed o...
[ "def", "read_sql", "(", "sql", ",", "con", ",", "index_col", "=", "None", ",", "coerce_float", "=", "True", ",", "params", "=", "None", ",", "parse_dates", "=", "None", ",", "columns", "=", "None", ",", "chunksize", "=", "None", ",", ")", ":", "_", ...
Read SQL query or database table into a DataFrame. Args: sql: string or SQLAlchemy Selectable (select or text object) SQL query to be executed or a table name. con: SQLAlchemy connectable (engine/connection) or database string URI or DBAPI2 connection (fallback mode) index_col: Column(s) to...
[ "Read", "SQL", "query", "or", "database", "table", "into", "a", "DataFrame", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/pandas/io.py#L286-L324
train
modin-project/modin
modin/engines/base/io.py
BaseIO.read_parquet
def read_parquet(cls, path, engine, columns, **kwargs): """Load a parquet object from the file path, returning a DataFrame. Ray DataFrame only supports pyarrow engine for now. Args: path: The filepath of the parquet file. We only support local files for now. ...
python
def read_parquet(cls, path, engine, columns, **kwargs): """Load a parquet object from the file path, returning a DataFrame. Ray DataFrame only supports pyarrow engine for now. Args: path: The filepath of the parquet file. We only support local files for now. ...
[ "def", "read_parquet", "(", "cls", ",", "path", ",", "engine", ",", "columns", ",", "*", "*", "kwargs", ")", ":", "ErrorMessage", ".", "default_to_pandas", "(", "\"`read_parquet`\"", ")", "return", "cls", ".", "from_pandas", "(", "pandas", ".", "read_parquet...
Load a parquet object from the file path, returning a DataFrame. Ray DataFrame only supports pyarrow engine for now. Args: path: The filepath of the parquet file. We only support local files for now. engine: Ray only support pyarrow reader. ...
[ "Load", "a", "parquet", "object", "from", "the", "file", "path", "returning", "a", "DataFrame", ".", "Ray", "DataFrame", "only", "supports", "pyarrow", "engine", "for", "now", "." ]
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/io.py#L17-L33
train
modin-project/modin
modin/engines/base/io.py
BaseIO._read
def _read(cls, **kwargs): """Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv """ pd_obj = pandas.read_csv(*...
python
def _read(cls, **kwargs): """Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv """ pd_obj = pandas.read_csv(*...
[ "def", "_read", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "pd_obj", "=", "pandas", ".", "read_csv", "(", "*", "*", "kwargs", ")", "if", "isinstance", "(", "pd_obj", ",", "pandas", ".", "DataFrame", ")", ":", "return", "cls", ".", "from_pandas", ...
Read csv file from local disk. Args: filepath_or_buffer: The filepath of the csv file. We only support local files for now. kwargs: Keyword arguments in pandas.read_csv
[ "Read", "csv", "file", "from", "local", "disk", ".", "Args", ":", "filepath_or_buffer", ":", "The", "filepath", "of", "the", "csv", "file", ".", "We", "only", "support", "local", "files", "for", "now", ".", "kwargs", ":", "Keyword", "arguments", "in", "p...
5b77d242596560c646b8405340c9ce64acb183cb
https://github.com/modin-project/modin/blob/5b77d242596560c646b8405340c9ce64acb183cb/modin/engines/base/io.py#L143-L161
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
auto_select_categorical_features
def auto_select_categorical_features(X, threshold=10): """Make a feature mask of categorical features in X. Features with less than 10 unique values are considered categorical. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix...
python
def auto_select_categorical_features(X, threshold=10): """Make a feature mask of categorical features in X. Features with less than 10 unique values are considered categorical. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix...
[ "def", "auto_select_categorical_features", "(", "X", ",", "threshold", "=", "10", ")", ":", "feature_mask", "=", "[", "]", "for", "column", "in", "range", "(", "X", ".", "shape", "[", "1", "]", ")", ":", "if", "sparse", ".", "issparse", "(", "X", ")"...
Make a feature mask of categorical features in X. Features with less than 10 unique values are considered categorical. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. threshold : int Maximum number of unique values...
[ "Make", "a", "feature", "mask", "of", "categorical", "features", "in", "X", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L45-L75
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
_X_selected
def _X_selected(X, selected): """Split X into selected features and other features""" n_features = X.shape[1] ind = np.arange(n_features) sel = np.zeros(n_features, dtype=bool) sel[np.asarray(selected)] = True non_sel = np.logical_not(sel) n_selected = np.sum(sel) X_sel = X[:, ind[sel]] ...
python
def _X_selected(X, selected): """Split X into selected features and other features""" n_features = X.shape[1] ind = np.arange(n_features) sel = np.zeros(n_features, dtype=bool) sel[np.asarray(selected)] = True non_sel = np.logical_not(sel) n_selected = np.sum(sel) X_sel = X[:, ind[sel]] ...
[ "def", "_X_selected", "(", "X", ",", "selected", ")", ":", "n_features", "=", "X", ".", "shape", "[", "1", "]", "ind", "=", "np", ".", "arange", "(", "n_features", ")", "sel", "=", "np", ".", "zeros", "(", "n_features", ",", "dtype", "=", "bool", ...
Split X into selected features and other features
[ "Split", "X", "into", "selected", "features", "and", "other", "features" ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L78-L88
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
_transform_selected
def _transform_selected(X, transform, selected, copy=True): """Apply a transform function to portion of selected features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. transform : callable A callable transform(X)...
python
def _transform_selected(X, transform, selected, copy=True): """Apply a transform function to portion of selected features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. transform : callable A callable transform(X)...
[ "def", "_transform_selected", "(", "X", ",", "transform", ",", "selected", ",", "copy", "=", "True", ")", ":", "if", "selected", "==", "\"all\"", ":", "return", "transform", "(", "X", ")", "if", "len", "(", "selected", ")", "==", "0", ":", "return", ...
Apply a transform function to portion of selected features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. transform : callable A callable transform(X) -> X_transformed copy : boolean, optional Copy X even...
[ "Apply", "a", "transform", "function", "to", "portion", "of", "selected", "features", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L91-L133
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
OneHotEncoder._matrix_adjust
def _matrix_adjust(self, X): """Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feat...
python
def _matrix_adjust(self, X): """Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feat...
[ "def", "_matrix_adjust", "(", "self", ",", "X", ")", ":", "data_matrix", "=", "X", ".", "data", "if", "sparse", ".", "issparse", "(", "X", ")", "else", "X", "# Shift all values to specially encode for NAN/infinity/OTHER and 0", "# Old value New Value", "# --...
Adjust all values in X to encode for NaNs and infinities in the data. Parameters ---------- X : array-like, shape=(n_samples, n_feature) Input array of type int. Returns ------- X : array-like, shape=(n_samples, n_feature) Input array without any...
[ "Adjust", "all", "values", "in", "X", "to", "encode", "for", "NaNs", "and", "infinities", "in", "the", "data", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L239-L267
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
OneHotEncoder._fit_transform
def _fit_transform(self, X): """Assume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. """ X = self._matrix_adjust(X) X = check_array( ...
python
def _fit_transform(self, X): """Assume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. """ X = self._matrix_adjust(X) X = check_array( ...
[ "def", "_fit_transform", "(", "self", ",", "X", ")", ":", "X", "=", "self", ".", "_matrix_adjust", "(", "X", ")", "X", "=", "check_array", "(", "X", ",", "accept_sparse", "=", "'csc'", ",", "force_all_finite", "=", "False", ",", "dtype", "=", "int", ...
Assume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix.
[ "Assume", "X", "contains", "only", "categorical", "features", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L269-L374
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
OneHotEncoder.fit_transform
def fit_transform(self, X, y=None): """Fit OneHotEncoder to X, then transform X. Equivalent to self.fit(X).transform(X), but more convenient and more efficient. See fit for the parameters, transform for the return value. Parameters ---------- X : array-like or sparse ma...
python
def fit_transform(self, X, y=None): """Fit OneHotEncoder to X, then transform X. Equivalent to self.fit(X).transform(X), but more convenient and more efficient. See fit for the parameters, transform for the return value. Parameters ---------- X : array-like or sparse ma...
[ "def", "fit_transform", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "if", "self", ".", "categorical_features", "==", "\"auto\"", ":", "self", ".", "categorical_features", "=", "auto_select_categorical_features", "(", "X", ",", "threshold", "=", "...
Fit OneHotEncoder to X, then transform X. Equivalent to self.fit(X).transform(X), but more convenient and more efficient. See fit for the parameters, transform for the return value. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) ...
[ "Fit", "OneHotEncoder", "to", "X", "then", "transform", "X", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L376-L397
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
OneHotEncoder._transform
def _transform(self, X): """Asssume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. """ X = self._matrix_adjust(X) X = check_array(X, accept_spar...
python
def _transform(self, X): """Asssume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. """ X = self._matrix_adjust(X) X = check_array(X, accept_spar...
[ "def", "_transform", "(", "self", ",", "X", ")", ":", "X", "=", "self", ".", "_matrix_adjust", "(", "X", ")", "X", "=", "check_array", "(", "X", ",", "accept_sparse", "=", "'csc'", ",", "force_all_finite", "=", "False", ",", "dtype", "=", "int", ")",...
Asssume X contains only categorical features. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix.
[ "Asssume", "X", "contains", "only", "categorical", "features", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L399-L479
train
EpistasisLab/tpot
tpot/builtins/one_hot_encoder.py
OneHotEncoder.transform
def transform(self, X): """Transform X using one-hot encoding. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. Returns ------- X_out : sparse matrix if sparse=True else a 2-d array, d...
python
def transform(self, X): """Transform X using one-hot encoding. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. Returns ------- X_out : sparse matrix if sparse=True else a 2-d array, d...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "return", "_transform_selected", "(", "X", ",", "self", ".", "_transform", ",", "self", ".", "categorical_features", ",", "copy", "=", "True", ")" ]
Transform X using one-hot encoding. Parameters ---------- X : array-like or sparse matrix, shape=(n_samples, n_features) Dense array or sparse matrix. Returns ------- X_out : sparse matrix if sparse=True else a 2-d array, dtype=int Transformed in...
[ "Transform", "X", "using", "one", "-", "hot", "encoding", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/one_hot_encoder.py#L481-L498
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.fit
def fit(self, features, target, sample_weight=None, groups=None): """Fit an optimized machine learning pipeline. Uses genetic programming to optimize a machine learning pipeline that maximizes score on the provided features and target. Performs internal k-fold cross-validaton to avoid o...
python
def fit(self, features, target, sample_weight=None, groups=None): """Fit an optimized machine learning pipeline. Uses genetic programming to optimize a machine learning pipeline that maximizes score on the provided features and target. Performs internal k-fold cross-validaton to avoid o...
[ "def", "fit", "(", "self", ",", "features", ",", "target", ",", "sample_weight", "=", "None", ",", "groups", "=", "None", ")", ":", "self", ".", "_fit_init", "(", ")", "features", ",", "target", "=", "self", ".", "_check_dataset", "(", "features", ",",...
Fit an optimized machine learning pipeline. Uses genetic programming to optimize a machine learning pipeline that maximizes score on the provided features and target. Performs internal k-fold cross-validaton to avoid overfitting on the provided data. The best pipeline is then trained on...
[ "Fit", "an", "optimized", "machine", "learning", "pipeline", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L621-L780
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._setup_memory
def _setup_memory(self): """Setup Memory object for memory caching. """ if self.memory: if isinstance(self.memory, str): if self.memory == "auto": # Create a temporary folder to store the transformers of the pipeline self._cache...
python
def _setup_memory(self): """Setup Memory object for memory caching. """ if self.memory: if isinstance(self.memory, str): if self.memory == "auto": # Create a temporary folder to store the transformers of the pipeline self._cache...
[ "def", "_setup_memory", "(", "self", ")", ":", "if", "self", ".", "memory", ":", "if", "isinstance", "(", "self", ".", "memory", ",", "str", ")", ":", "if", "self", ".", "memory", "==", "\"auto\"", ":", "# Create a temporary folder to store the transformers of...
Setup Memory object for memory caching.
[ "Setup", "Memory", "object", "for", "memory", "caching", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L783-L809
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._update_top_pipeline
def _update_top_pipeline(self): """Helper function to update the _optimized_pipeline field.""" # Store the pipeline with the highest internal testing score if self._pareto_front: self._optimized_pipeline_score = -float('inf') for pipeline, pipeline_scores in zip(self._par...
python
def _update_top_pipeline(self): """Helper function to update the _optimized_pipeline field.""" # Store the pipeline with the highest internal testing score if self._pareto_front: self._optimized_pipeline_score = -float('inf') for pipeline, pipeline_scores in zip(self._par...
[ "def", "_update_top_pipeline", "(", "self", ")", ":", "# Store the pipeline with the highest internal testing score", "if", "self", ".", "_pareto_front", ":", "self", ".", "_optimized_pipeline_score", "=", "-", "float", "(", "'inf'", ")", "for", "pipeline", ",", "pipe...
Helper function to update the _optimized_pipeline field.
[ "Helper", "function", "to", "update", "the", "_optimized_pipeline", "field", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L819-L848
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._summary_of_best_pipeline
def _summary_of_best_pipeline(self, features, target): """Print out best pipeline at the end of optimization process. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels fo...
python
def _summary_of_best_pipeline(self, features, target): """Print out best pipeline at the end of optimization process. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels fo...
[ "def", "_summary_of_best_pipeline", "(", "self", ",", "features", ",", "target", ")", ":", "if", "not", "self", ".", "_optimized_pipeline", ":", "raise", "RuntimeError", "(", "'There was an error in the TPOT optimization '", "'process. This could be because the data was '", ...
Print out best pipeline at the end of optimization process. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels for prediction Returns ------- self: object...
[ "Print", "out", "best", "pipeline", "at", "the", "end", "of", "optimization", "process", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L850-L895
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.predict
def predict(self, features): """Use the optimized pipeline to predict the target for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix Returns ---------- array-like: {n_samples} Predicted tar...
python
def predict(self, features): """Use the optimized pipeline to predict the target for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix Returns ---------- array-like: {n_samples} Predicted tar...
[ "def", "predict", "(", "self", ",", "features", ")", ":", "if", "not", "self", ".", "fitted_pipeline_", ":", "raise", "RuntimeError", "(", "'A pipeline has not yet been optimized. Please call fit() first.'", ")", "features", "=", "self", ".", "_check_dataset", "(", ...
Use the optimized pipeline to predict the target for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix Returns ---------- array-like: {n_samples} Predicted target for the samples in the feature matri...
[ "Use", "the", "optimized", "pipeline", "to", "predict", "the", "target", "for", "a", "feature", "set", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L897-L916
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.fit_predict
def fit_predict(self, features, target, sample_weight=None, groups=None): """Call fit and predict in sequence. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels for predic...
python
def fit_predict(self, features, target, sample_weight=None, groups=None): """Call fit and predict in sequence. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels for predic...
[ "def", "fit_predict", "(", "self", ",", "features", ",", "target", ",", "sample_weight", "=", "None", ",", "groups", "=", "None", ")", ":", "self", ".", "fit", "(", "features", ",", "target", ",", "sample_weight", "=", "sample_weight", ",", "groups", "="...
Call fit and predict in sequence. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} List of class labels for prediction sample_weight: array-like {n_samples}, optional Per-sample w...
[ "Call", "fit", "and", "predict", "in", "sequence", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L918-L942
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.score
def score(self, testing_features, testing_target): """Return the score on the given testing data using the user-specified scoring function. Parameters ---------- testing_features: array-like {n_samples, n_features} Feature matrix of the testing set testing_target: ar...
python
def score(self, testing_features, testing_target): """Return the score on the given testing data using the user-specified scoring function. Parameters ---------- testing_features: array-like {n_samples, n_features} Feature matrix of the testing set testing_target: ar...
[ "def", "score", "(", "self", ",", "testing_features", ",", "testing_target", ")", ":", "if", "self", ".", "fitted_pipeline_", "is", "None", ":", "raise", "RuntimeError", "(", "'A pipeline has not yet been optimized. Please call fit() first.'", ")", "testing_features", "...
Return the score on the given testing data using the user-specified scoring function. Parameters ---------- testing_features: array-like {n_samples, n_features} Feature matrix of the testing set testing_target: array-like {n_samples} List of class labels for pred...
[ "Return", "the", "score", "on", "the", "given", "testing", "data", "using", "the", "user", "-", "specified", "scoring", "function", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L944-L972
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.predict_proba
def predict_proba(self, features): """Use the optimized pipeline to estimate the class probabilities for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix of the testing set Returns ------- array-like: {...
python
def predict_proba(self, features): """Use the optimized pipeline to estimate the class probabilities for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix of the testing set Returns ------- array-like: {...
[ "def", "predict_proba", "(", "self", ",", "features", ")", ":", "if", "not", "self", ".", "fitted_pipeline_", ":", "raise", "RuntimeError", "(", "'A pipeline has not yet been optimized. Please call fit() first.'", ")", "else", ":", "if", "not", "(", "hasattr", "(", ...
Use the optimized pipeline to estimate the class probabilities for a feature set. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix of the testing set Returns ------- array-like: {n_samples, n_target} The class pro...
[ "Use", "the", "optimized", "pipeline", "to", "estimate", "the", "class", "probabilities", "for", "a", "feature", "set", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L974-L996
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.clean_pipeline_string
def clean_pipeline_string(self, individual): """Provide a string of the individual without the parameter prefixes. Parameters ---------- individual: individual Individual which should be represented by a pretty string Returns ------- A string like st...
python
def clean_pipeline_string(self, individual): """Provide a string of the individual without the parameter prefixes. Parameters ---------- individual: individual Individual which should be represented by a pretty string Returns ------- A string like st...
[ "def", "clean_pipeline_string", "(", "self", ",", "individual", ")", ":", "dirty_string", "=", "str", "(", "individual", ")", "# There are many parameter prefixes in the pipeline strings, used solely for", "# making the terminal name unique, eg. LinearSVC__.", "parameter_prefixes", ...
Provide a string of the individual without the parameter prefixes. Parameters ---------- individual: individual Individual which should be represented by a pretty string Returns ------- A string like str(individual), but with parameter prefixes removed.
[ "Provide", "a", "string", "of", "the", "individual", "without", "the", "parameter", "prefixes", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L999-L1021
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._check_periodic_pipeline
def _check_periodic_pipeline(self, gen): """If enough time has passed, save a new optimized pipeline. Currently used in the per generation hook in the optimization loop. Parameters ---------- gen: int Generation number Returns ------- None """...
python
def _check_periodic_pipeline(self, gen): """If enough time has passed, save a new optimized pipeline. Currently used in the per generation hook in the optimization loop. Parameters ---------- gen: int Generation number Returns ------- None """...
[ "def", "_check_periodic_pipeline", "(", "self", ",", "gen", ")", ":", "self", ".", "_update_top_pipeline", "(", ")", "if", "self", ".", "periodic_checkpoint_folder", "is", "not", "None", ":", "total_since_last_pipeline_save", "=", "(", "datetime", ".", "now", "(...
If enough time has passed, save a new optimized pipeline. Currently used in the per generation hook in the optimization loop. Parameters ---------- gen: int Generation number Returns ------- None
[ "If", "enough", "time", "has", "passed", "save", "a", "new", "optimized", "pipeline", ".", "Currently", "used", "in", "the", "per", "generation", "hook", "in", "the", "optimization", "loop", ".", "Parameters", "----------", "gen", ":", "int", "Generation", "...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1023-L1044
train
EpistasisLab/tpot
tpot/base.py
TPOTBase.export
def export(self, output_file_name, data_file_path=''): """Export the optimized pipeline as Python code. Parameters ---------- output_file_name: string String containing the path and file name of the desired output file data_file_path: string (default: '') ...
python
def export(self, output_file_name, data_file_path=''): """Export the optimized pipeline as Python code. Parameters ---------- output_file_name: string String containing the path and file name of the desired output file data_file_path: string (default: '') ...
[ "def", "export", "(", "self", ",", "output_file_name", ",", "data_file_path", "=", "''", ")", ":", "if", "self", ".", "_optimized_pipeline", "is", "None", ":", "raise", "RuntimeError", "(", "'A pipeline has not yet been optimized. Please call fit() first.'", ")", "to_...
Export the optimized pipeline as Python code. Parameters ---------- output_file_name: string String containing the path and file name of the desired output file data_file_path: string (default: '') By default, the path of input dataset is 'PATH/TO/DATA/FILE' by d...
[ "Export", "the", "optimized", "pipeline", "as", "Python", "code", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1086-L1113
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._impute_values
def _impute_values(self, features): """Impute missing values in a feature set. Parameters ---------- features: array-like {n_samples, n_features} A feature matrix Returns ------- array-like {n_samples, n_features} """ if self.verbosit...
python
def _impute_values(self, features): """Impute missing values in a feature set. Parameters ---------- features: array-like {n_samples, n_features} A feature matrix Returns ------- array-like {n_samples, n_features} """ if self.verbosit...
[ "def", "_impute_values", "(", "self", ",", "features", ")", ":", "if", "self", ".", "verbosity", ">", "1", ":", "print", "(", "'Imputing missing values in feature set'", ")", "if", "self", ".", "_fitted_imputer", "is", "None", ":", "self", ".", "_fitted_impute...
Impute missing values in a feature set. Parameters ---------- features: array-like {n_samples, n_features} A feature matrix Returns ------- array-like {n_samples, n_features}
[ "Impute", "missing", "values", "in", "a", "feature", "set", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1116-L1135
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._check_dataset
def _check_dataset(self, features, target, sample_weight=None): """Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of clas...
python
def _check_dataset(self, features, target, sample_weight=None): """Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of clas...
[ "def", "_check_dataset", "(", "self", ",", "features", ",", "target", ",", "sample_weight", "=", "None", ")", ":", "# Check sample_weight", "if", "sample_weight", "is", "not", "None", ":", "try", ":", "sample_weight", "=", "np", ".", "array", "(", "sample_we...
Check if a dataset has a valid feature set and labels. Parameters ---------- features: array-like {n_samples, n_features} Feature matrix target: array-like {n_samples} or None List of class labels for prediction sample_weight: array-like {n_samples} (opti...
[ "Check", "if", "a", "dataset", "has", "a", "valid", "feature", "set", "and", "labels", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1137-L1205
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._compile_to_sklearn
def _compile_to_sklearn(self, expr): """Compile a DEAP pipeline into a sklearn pipeline. Parameters ---------- expr: DEAP individual The DEAP pipeline to be compiled Returns ------- sklearn_pipeline: sklearn.pipeline.Pipeline """ skle...
python
def _compile_to_sklearn(self, expr): """Compile a DEAP pipeline into a sklearn pipeline. Parameters ---------- expr: DEAP individual The DEAP pipeline to be compiled Returns ------- sklearn_pipeline: sklearn.pipeline.Pipeline """ skle...
[ "def", "_compile_to_sklearn", "(", "self", ",", "expr", ")", ":", "sklearn_pipeline_str", "=", "generate_pipeline_code", "(", "expr_to_tree", "(", "expr", ",", "self", ".", "_pset", ")", ",", "self", ".", "operators", ")", "sklearn_pipeline", "=", "eval", "(",...
Compile a DEAP pipeline into a sklearn pipeline. Parameters ---------- expr: DEAP individual The DEAP pipeline to be compiled Returns ------- sklearn_pipeline: sklearn.pipeline.Pipeline
[ "Compile", "a", "DEAP", "pipeline", "into", "a", "sklearn", "pipeline", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1208-L1223
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._set_param_recursive
def _set_param_recursive(self, pipeline_steps, parameter, value): """Recursively iterate through all objects in the pipeline and set a given parameter. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object ...
python
def _set_param_recursive(self, pipeline_steps, parameter, value): """Recursively iterate through all objects in the pipeline and set a given parameter. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object ...
[ "def", "_set_param_recursive", "(", "self", ",", "pipeline_steps", ",", "parameter", ",", "value", ")", ":", "for", "(", "_", ",", "obj", ")", "in", "pipeline_steps", ":", "recursive_attrs", "=", "[", "'steps'", ",", "'transformer_list'", ",", "'estimators'", ...
Recursively iterate through all objects in the pipeline and set a given parameter. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object parameter: str The parameter to assign a value for in each...
[ "Recursively", "iterate", "through", "all", "objects", "in", "the", "pipeline", "and", "set", "a", "given", "parameter", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1225-L1251
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._stop_by_max_time_mins
def _stop_by_max_time_mins(self): """Stop optimization process once maximum minutes have elapsed.""" if self.max_time_mins: total_mins_elapsed = (datetime.now() - self._start_datetime).total_seconds() / 60. if total_mins_elapsed >= self.max_time_mins: raise Keyboa...
python
def _stop_by_max_time_mins(self): """Stop optimization process once maximum minutes have elapsed.""" if self.max_time_mins: total_mins_elapsed = (datetime.now() - self._start_datetime).total_seconds() / 60. if total_mins_elapsed >= self.max_time_mins: raise Keyboa...
[ "def", "_stop_by_max_time_mins", "(", "self", ")", ":", "if", "self", ".", "max_time_mins", ":", "total_mins_elapsed", "=", "(", "datetime", ".", "now", "(", ")", "-", "self", ".", "_start_datetime", ")", ".", "total_seconds", "(", ")", "/", "60.", "if", ...
Stop optimization process once maximum minutes have elapsed.
[ "Stop", "optimization", "process", "once", "maximum", "minutes", "have", "elapsed", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1253-L1258
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._combine_individual_stats
def _combine_individual_stats(self, operator_count, cv_score, individual_stats): """Combine the stats with operator count and cv score and preprare to be written to _evaluated_individuals Parameters ---------- operator_count: int number of components in the pipeline ...
python
def _combine_individual_stats(self, operator_count, cv_score, individual_stats): """Combine the stats with operator count and cv score and preprare to be written to _evaluated_individuals Parameters ---------- operator_count: int number of components in the pipeline ...
[ "def", "_combine_individual_stats", "(", "self", ",", "operator_count", ",", "cv_score", ",", "individual_stats", ")", ":", "stats", "=", "deepcopy", "(", "individual_stats", ")", "# Deepcopy, since the string reference to predecessor should be cloned", "stats", "[", "'oper...
Combine the stats with operator count and cv score and preprare to be written to _evaluated_individuals Parameters ---------- operator_count: int number of components in the pipeline cv_score: float internal cross validation score individual_stats: dictio...
[ "Combine", "the", "stats", "with", "operator", "count", "and", "cv", "score", "and", "preprare", "to", "be", "written", "to", "_evaluated_individuals" ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1260-L1287
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._evaluate_individuals
def _evaluate_individuals(self, population, features, target, sample_weight=None, groups=None): """Determine the fit of the provided individuals. Parameters ---------- population: a list of DEAP individual One individual is a list of pipeline operators and model parameters t...
python
def _evaluate_individuals(self, population, features, target, sample_weight=None, groups=None): """Determine the fit of the provided individuals. Parameters ---------- population: a list of DEAP individual One individual is a list of pipeline operators and model parameters t...
[ "def", "_evaluate_individuals", "(", "self", ",", "population", ",", "features", ",", "target", ",", "sample_weight", "=", "None", ",", "groups", "=", "None", ")", ":", "# Evaluate the individuals with an invalid fitness", "individuals", "=", "[", "ind", "for", "i...
Determine the fit of the provided individuals. Parameters ---------- population: a list of DEAP individual One individual is a list of pipeline operators and model parameters that can be compiled by DEAP into a callable function features: numpy.ndarray {n_samples...
[ "Determine", "the", "fit", "of", "the", "provided", "individuals", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1289-L1407
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._preprocess_individuals
def _preprocess_individuals(self, individuals): """Preprocess DEAP individuals before pipeline evaluation. Parameters ---------- individuals: a list of DEAP individual One individual is a list of pipeline operators and model parameters that can be compiled by DEA...
python
def _preprocess_individuals(self, individuals): """Preprocess DEAP individuals before pipeline evaluation. Parameters ---------- individuals: a list of DEAP individual One individual is a list of pipeline operators and model parameters that can be compiled by DEA...
[ "def", "_preprocess_individuals", "(", "self", ",", "individuals", ")", ":", "# update self._pbar.total", "if", "not", "(", "self", ".", "max_time_mins", "is", "None", ")", "and", "not", "self", ".", "_pbar", ".", "disable", "and", "self", ".", "_pbar", ".",...
Preprocess DEAP individuals before pipeline evaluation. Parameters ---------- individuals: a list of DEAP individual One individual is a list of pipeline operators and model parameters that can be compiled by DEAP into a callable function Returns -------...
[ "Preprocess", "DEAP", "individuals", "before", "pipeline", "evaluation", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1409-L1492
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._update_evaluated_individuals_
def _update_evaluated_individuals_(self, result_score_list, eval_individuals_str, operator_counts, stats_dicts): """Update self.evaluated_individuals_ and error message during pipeline evaluation. Parameters ---------- result_score_list: list A list of CV scores for evaluate...
python
def _update_evaluated_individuals_(self, result_score_list, eval_individuals_str, operator_counts, stats_dicts): """Update self.evaluated_individuals_ and error message during pipeline evaluation. Parameters ---------- result_score_list: list A list of CV scores for evaluate...
[ "def", "_update_evaluated_individuals_", "(", "self", ",", "result_score_list", ",", "eval_individuals_str", ",", "operator_counts", ",", "stats_dicts", ")", ":", "for", "result_score", ",", "individual_str", "in", "zip", "(", "result_score_list", ",", "eval_individuals...
Update self.evaluated_individuals_ and error message during pipeline evaluation. Parameters ---------- result_score_list: list A list of CV scores for evaluated pipelines eval_individuals_str: list A list of strings for evaluated pipelines operator_counts...
[ "Update", "self", ".", "evaluated_individuals_", "and", "error", "message", "during", "pipeline", "evaluation", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1494-L1519
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._update_pbar
def _update_pbar(self, pbar_num=1, pbar_msg=None): """Update self._pbar and error message during pipeline evaluation. Parameters ---------- pbar_num: int How many pipelines has been processed pbar_msg: None or string Error message Returns ...
python
def _update_pbar(self, pbar_num=1, pbar_msg=None): """Update self._pbar and error message during pipeline evaluation. Parameters ---------- pbar_num: int How many pipelines has been processed pbar_msg: None or string Error message Returns ...
[ "def", "_update_pbar", "(", "self", ",", "pbar_num", "=", "1", ",", "pbar_msg", "=", "None", ")", ":", "if", "not", "isinstance", "(", "self", ".", "_pbar", ",", "type", "(", "None", ")", ")", ":", "if", "self", ".", "verbosity", ">", "2", "and", ...
Update self._pbar and error message during pipeline evaluation. Parameters ---------- pbar_num: int How many pipelines has been processed pbar_msg: None or string Error message Returns ------- None
[ "Update", "self", ".", "_pbar", "and", "error", "message", "during", "pipeline", "evaluation", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1521-L1539
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._random_mutation_operator
def _random_mutation_operator(self, individual, allow_shrink=True): """Perform a replacement, insertion, or shrink mutation on an individual. Parameters ---------- individual: DEAP individual A list of pipeline operators and model parameters that can be compiled ...
python
def _random_mutation_operator(self, individual, allow_shrink=True): """Perform a replacement, insertion, or shrink mutation on an individual. Parameters ---------- individual: DEAP individual A list of pipeline operators and model parameters that can be compiled ...
[ "def", "_random_mutation_operator", "(", "self", ",", "individual", ",", "allow_shrink", "=", "True", ")", ":", "if", "self", ".", "tree_structure", ":", "mutation_techniques", "=", "[", "partial", "(", "gp", ".", "mutInsert", ",", "pset", "=", "self", ".", ...
Perform a replacement, insertion, or shrink mutation on an individual. Parameters ---------- individual: DEAP individual A list of pipeline operators and model parameters that can be compiled by DEAP into a callable function allow_shrink: bool (True) ...
[ "Perform", "a", "replacement", "insertion", "or", "shrink", "mutation", "on", "an", "individual", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1564-L1623
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._gen_grow_safe
def _gen_grow_safe(self, pset, min_, max_, type_=None): """Generate an expression where each leaf might have a different depth between min_ and max_. Parameters ---------- pset: PrimitiveSetTyped Primitive set from which primitives are selected. min_: int ...
python
def _gen_grow_safe(self, pset, min_, max_, type_=None): """Generate an expression where each leaf might have a different depth between min_ and max_. Parameters ---------- pset: PrimitiveSetTyped Primitive set from which primitives are selected. min_: int ...
[ "def", "_gen_grow_safe", "(", "self", ",", "pset", ",", "min_", ",", "max_", ",", "type_", "=", "None", ")", ":", "def", "condition", "(", "height", ",", "depth", ",", "type_", ")", ":", "\"\"\"Stop when the depth is equal to height or when a node should be a term...
Generate an expression where each leaf might have a different depth between min_ and max_. Parameters ---------- pset: PrimitiveSetTyped Primitive set from which primitives are selected. min_: int Minimum height of the produced trees. max_: int ...
[ "Generate", "an", "expression", "where", "each", "leaf", "might", "have", "a", "different", "depth", "between", "min_", "and", "max_", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1625-L1650
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._operator_count
def _operator_count(self, individual): """Count the number of pipeline operators as a measure of pipeline complexity. Parameters ---------- individual: list A grown tree with leaves at possibly different depths dependending on the condition function. Ret...
python
def _operator_count(self, individual): """Count the number of pipeline operators as a measure of pipeline complexity. Parameters ---------- individual: list A grown tree with leaves at possibly different depths dependending on the condition function. Ret...
[ "def", "_operator_count", "(", "self", ",", "individual", ")", ":", "operator_count", "=", "0", "for", "i", "in", "range", "(", "len", "(", "individual", ")", ")", ":", "node", "=", "individual", "[", "i", "]", "if", "type", "(", "node", ")", "is", ...
Count the number of pipeline operators as a measure of pipeline complexity. Parameters ---------- individual: list A grown tree with leaves at possibly different depths dependending on the condition function. Returns ------- operator_count: int ...
[ "Count", "the", "number", "of", "pipeline", "operators", "as", "a", "measure", "of", "pipeline", "complexity", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1653-L1672
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._update_val
def _update_val(self, val, result_score_list): """Update values in the list of result scores and self._pbar during pipeline evaluation. Parameters ---------- val: float or "Timeout" CV scores result_score_list: list A list of CV scores Returns ...
python
def _update_val(self, val, result_score_list): """Update values in the list of result scores and self._pbar during pipeline evaluation. Parameters ---------- val: float or "Timeout" CV scores result_score_list: list A list of CV scores Returns ...
[ "def", "_update_val", "(", "self", ",", "val", ",", "result_score_list", ")", ":", "self", ".", "_update_pbar", "(", ")", "if", "val", "==", "'Timeout'", ":", "self", ".", "_update_pbar", "(", "pbar_msg", "=", "(", "'Skipped pipeline #{0} due to time out. '", ...
Update values in the list of result scores and self._pbar during pipeline evaluation. Parameters ---------- val: float or "Timeout" CV scores result_score_list: list A list of CV scores Returns ------- result_score_list: list ...
[ "Update", "values", "in", "the", "list", "of", "result", "scores", "and", "self", ".", "_pbar", "during", "pipeline", "evaluation", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1674-L1696
train
EpistasisLab/tpot
tpot/base.py
TPOTBase._generate
def _generate(self, pset, min_, max_, condition, type_=None): """Generate a Tree as a list of lists. The tree is build from the root to the leaves, and it stop growing when the condition is fulfilled. Parameters ---------- pset: PrimitiveSetTyped Primitive s...
python
def _generate(self, pset, min_, max_, condition, type_=None): """Generate a Tree as a list of lists. The tree is build from the root to the leaves, and it stop growing when the condition is fulfilled. Parameters ---------- pset: PrimitiveSetTyped Primitive s...
[ "def", "_generate", "(", "self", ",", "pset", ",", "min_", ",", "max_", ",", "condition", ",", "type_", "=", "None", ")", ":", "if", "type_", "is", "None", ":", "type_", "=", "pset", ".", "ret", "expr", "=", "[", "]", "height", "=", "np", ".", ...
Generate a Tree as a list of lists. The tree is build from the root to the leaves, and it stop growing when the condition is fulfilled. Parameters ---------- pset: PrimitiveSetTyped Primitive set from which primitives are selected. min_: int Mini...
[ "Generate", "a", "Tree", "as", "a", "list", "of", "lists", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/base.py#L1699-L1762
train
EpistasisLab/tpot
tpot/builtins/feature_transformers.py
CategoricalSelector.transform
def transform(self, X): """Select categorical features and transform them using OneHotEncoder. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ...
python
def transform(self, X): """Select categorical features and transform them using OneHotEncoder. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "selected", "=", "auto_select_categorical_features", "(", "X", ",", "threshold", "=", "self", ".", "threshold", ")", "X_sel", ",", "_", ",", "n_selected", ",", "_", "=", "_X_selected", "(", "X", ",", ...
Select categorical features and transform them using OneHotEncoder. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ------- array-like,...
[ "Select", "categorical", "features", "and", "transform", "them", "using", "OneHotEncoder", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_transformers.py#L63-L83
train
EpistasisLab/tpot
tpot/builtins/feature_transformers.py
ContinuousSelector.transform
def transform(self, X): """Select continuous features and transform them using PCA. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ---...
python
def transform(self, X): """Select continuous features and transform them using PCA. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ---...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "selected", "=", "auto_select_categorical_features", "(", "X", ",", "threshold", "=", "self", ".", "threshold", ")", "_", ",", "X_sel", ",", "n_selected", ",", "_", "=", "_X_selected", "(", "X", ",", ...
Select continuous features and transform them using PCA. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ------- array-like, {n_samples...
[ "Select", "continuous", "features", "and", "transform", "them", "using", "PCA", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_transformers.py#L140-L160
train
EpistasisLab/tpot
tpot/builtins/stacking_estimator.py
StackingEstimator.fit
def fit(self, X, y=None, **fit_params): """Fit the StackingEstimator meta-transformer. Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that corr...
python
def fit(self, X, y=None, **fit_params): """Fit the StackingEstimator meta-transformer. Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that corr...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ",", "*", "*", "fit_params", ")", ":", "self", ".", "estimator", ".", "fit", "(", "X", ",", "y", ",", "*", "*", "fit_params", ")", "return", "self" ]
Fit the StackingEstimator meta-transformer. Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to classes in classification, real numbers i...
[ "Fit", "the", "StackingEstimator", "meta", "-", "transformer", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/stacking_estimator.py#L50-L68
train
EpistasisLab/tpot
tpot/builtins/stacking_estimator.py
StackingEstimator.transform
def transform(self, X): """Transform data by adding two synthetic feature(s). Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ------- ...
python
def transform(self, X): """Transform data by adding two synthetic feature(s). Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ------- ...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "X", "=", "check_array", "(", "X", ")", "X_transformed", "=", "np", ".", "copy", "(", "X", ")", "# add class probabilities as a synthetic feature", "if", "issubclass", "(", "self", ".", "estimator", ".", ...
Transform data by adding two synthetic feature(s). Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. Returns ------- X_transformed: array-like, s...
[ "Transform", "data", "by", "adding", "two", "synthetic", "feature", "(", "s", ")", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/stacking_estimator.py#L70-L92
train
EpistasisLab/tpot
tpot/metrics.py
balanced_accuracy
def balanced_accuracy(y_true, y_pred): """Default scoring function: balanced accuracy. Balanced accuracy computes each class' accuracy on a per-class basis using a one-vs-rest encoding, then computes an unweighted average of the class accuracies. Parameters ---------- y_true: numpy.ndarray {n_...
python
def balanced_accuracy(y_true, y_pred): """Default scoring function: balanced accuracy. Balanced accuracy computes each class' accuracy on a per-class basis using a one-vs-rest encoding, then computes an unweighted average of the class accuracies. Parameters ---------- y_true: numpy.ndarray {n_...
[ "def", "balanced_accuracy", "(", "y_true", ",", "y_pred", ")", ":", "all_classes", "=", "list", "(", "set", "(", "np", ".", "append", "(", "y_true", ",", "y_pred", ")", ")", ")", "all_class_accuracies", "=", "[", "]", "for", "this_class", "in", "all_clas...
Default scoring function: balanced accuracy. Balanced accuracy computes each class' accuracy on a per-class basis using a one-vs-rest encoding, then computes an unweighted average of the class accuracies. Parameters ---------- y_true: numpy.ndarray {n_samples} True class labels y_pred:...
[ "Default", "scoring", "function", ":", "balanced", "accuracy", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/metrics.py#L30-L66
train
EpistasisLab/tpot
tpot/builtins/zero_count.py
ZeroCount.transform
def transform(self, X, y=None): """Transform data by adding two virtual features. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. y: None ...
python
def transform(self, X, y=None): """Transform data by adding two virtual features. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. y: None ...
[ "def", "transform", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "X", "=", "check_array", "(", "X", ")", "n_features", "=", "X", ".", "shape", "[", "1", "]", "X_transformed", "=", "np", ".", "copy", "(", "X", ")", "non_zero_vector", "=...
Transform data by adding two virtual features. Parameters ---------- X: numpy ndarray, {n_samples, n_components} New data, where n_samples is the number of samples and n_components is the number of components. y: None Unused Returns -...
[ "Transform", "data", "by", "adding", "two", "virtual", "features", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/zero_count.py#L38-L66
train
EpistasisLab/tpot
tpot/operator_utils.py
source_decode
def source_decode(sourcecode, verbose=0): """Decode operator source and import operator class. Parameters ---------- sourcecode: string a string of operator source (e.g 'sklearn.feature_selection.RFE') verbose: int, optional (default: 0) How much information TPOT communicates while ...
python
def source_decode(sourcecode, verbose=0): """Decode operator source and import operator class. Parameters ---------- sourcecode: string a string of operator source (e.g 'sklearn.feature_selection.RFE') verbose: int, optional (default: 0) How much information TPOT communicates while ...
[ "def", "source_decode", "(", "sourcecode", ",", "verbose", "=", "0", ")", ":", "tmp_path", "=", "sourcecode", ".", "split", "(", "'.'", ")", "op_str", "=", "tmp_path", ".", "pop", "(", ")", "import_str", "=", "'.'", ".", "join", "(", "tmp_path", ")", ...
Decode operator source and import operator class. Parameters ---------- sourcecode: string a string of operator source (e.g 'sklearn.feature_selection.RFE') verbose: int, optional (default: 0) How much information TPOT communicates while it's running. 0 = none, 1 = minimal, 2 = ...
[ "Decode", "operator", "source", "and", "import", "operator", "class", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/operator_utils.py#L47-L86
train
EpistasisLab/tpot
tpot/operator_utils.py
set_sample_weight
def set_sample_weight(pipeline_steps, sample_weight=None): """Recursively iterates through all objects in the pipeline and sets sample weight. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object sample_weight: array-like ...
python
def set_sample_weight(pipeline_steps, sample_weight=None): """Recursively iterates through all objects in the pipeline and sets sample weight. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object sample_weight: array-like ...
[ "def", "set_sample_weight", "(", "pipeline_steps", ",", "sample_weight", "=", "None", ")", ":", "sample_weight_dict", "=", "{", "}", "if", "not", "isinstance", "(", "sample_weight", ",", "type", "(", "None", ")", ")", ":", "for", "(", "pname", ",", "obj", ...
Recursively iterates through all objects in the pipeline and sets sample weight. Parameters ---------- pipeline_steps: array-like List of (str, obj) tuples from a scikit-learn pipeline or related object sample_weight: array-like List of sample weight Returns ------- sample_w...
[ "Recursively", "iterates", "through", "all", "objects", "in", "the", "pipeline", "and", "sets", "sample", "weight", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/operator_utils.py#L89-L114
train
EpistasisLab/tpot
tpot/operator_utils.py
TPOTOperatorClassFactory
def TPOTOperatorClassFactory(opsourse, opdict, BaseClass=Operator, ArgBaseClass=ARGType, verbose=0): """Dynamically create operator class. Parameters ---------- opsourse: string operator source in config dictionary (key) opdict: dictionary operator params in config dictionary (value...
python
def TPOTOperatorClassFactory(opsourse, opdict, BaseClass=Operator, ArgBaseClass=ARGType, verbose=0): """Dynamically create operator class. Parameters ---------- opsourse: string operator source in config dictionary (key) opdict: dictionary operator params in config dictionary (value...
[ "def", "TPOTOperatorClassFactory", "(", "opsourse", ",", "opdict", ",", "BaseClass", "=", "Operator", ",", "ArgBaseClass", "=", "ARGType", ",", "verbose", "=", "0", ")", ":", "class_profile", "=", "{", "}", "dep_op_list", "=", "{", "}", "# list of nested estim...
Dynamically create operator class. Parameters ---------- opsourse: string operator source in config dictionary (key) opdict: dictionary operator params in config dictionary (value) regression: bool True if it can be used in TPOTRegressor classification: bool True...
[ "Dynamically", "create", "operator", "class", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/operator_utils.py#L138-L303
train
EpistasisLab/tpot
tpot/driver.py
positive_integer
def positive_integer(value): """Ensure that the provided value is a positive integer. Parameters ---------- value: int The number to evaluate Returns ------- value: int Returns a positive integer """ try: value = int(value) except Exception: rais...
python
def positive_integer(value): """Ensure that the provided value is a positive integer. Parameters ---------- value: int The number to evaluate Returns ------- value: int Returns a positive integer """ try: value = int(value) except Exception: rais...
[ "def", "positive_integer", "(", "value", ")", ":", "try", ":", "value", "=", "int", "(", "value", ")", "except", "Exception", ":", "raise", "argparse", ".", "ArgumentTypeError", "(", "'Invalid int value: \\'{}\\''", ".", "format", "(", "value", ")", ")", "if...
Ensure that the provided value is a positive integer. Parameters ---------- value: int The number to evaluate Returns ------- value: int Returns a positive integer
[ "Ensure", "that", "the", "provided", "value", "is", "a", "positive", "integer", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/driver.py#L40-L59
train
EpistasisLab/tpot
tpot/driver.py
float_range
def float_range(value): """Ensure that the provided value is a float integer in the range [0., 1.]. Parameters ---------- value: float The number to evaluate Returns ------- value: float Returns a float in the range (0., 1.) """ try: value = float(value) ...
python
def float_range(value): """Ensure that the provided value is a float integer in the range [0., 1.]. Parameters ---------- value: float The number to evaluate Returns ------- value: float Returns a float in the range (0., 1.) """ try: value = float(value) ...
[ "def", "float_range", "(", "value", ")", ":", "try", ":", "value", "=", "float", "(", "value", ")", "except", "Exception", ":", "raise", "argparse", ".", "ArgumentTypeError", "(", "'Invalid float value: \\'{}\\''", ".", "format", "(", "value", ")", ")", "if"...
Ensure that the provided value is a float integer in the range [0., 1.]. Parameters ---------- value: float The number to evaluate Returns ------- value: float Returns a float in the range (0., 1.)
[ "Ensure", "that", "the", "provided", "value", "is", "a", "float", "integer", "in", "the", "range", "[", "0", ".", "1", ".", "]", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/driver.py#L62-L81
train
EpistasisLab/tpot
tpot/driver.py
_get_arg_parser
def _get_arg_parser(): """Main function that is called when TPOT is run on the command line.""" parser = argparse.ArgumentParser( description=( 'A Python tool that automatically creates and optimizes machine ' 'learning pipelines using genetic programming.' ), add...
python
def _get_arg_parser(): """Main function that is called when TPOT is run on the command line.""" parser = argparse.ArgumentParser( description=( 'A Python tool that automatically creates and optimizes machine ' 'learning pipelines using genetic programming.' ), add...
[ "def", "_get_arg_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "(", "'A Python tool that automatically creates and optimizes machine '", "'learning pipelines using genetic programming.'", ")", ",", "add_help", "=", "False",...
Main function that is called when TPOT is run on the command line.
[ "Main", "function", "that", "is", "called", "when", "TPOT", "is", "run", "on", "the", "command", "line", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/driver.py#L84-L451
train
EpistasisLab/tpot
tpot/driver.py
load_scoring_function
def load_scoring_function(scoring_func): """ converts mymodule.myfunc in the myfunc object itself so tpot receives a scoring function """ if scoring_func and ("." in scoring_func): try: module_name, func_name = scoring_func.rsplit('.', 1) module_path = os.getcwd() ...
python
def load_scoring_function(scoring_func): """ converts mymodule.myfunc in the myfunc object itself so tpot receives a scoring function """ if scoring_func and ("." in scoring_func): try: module_name, func_name = scoring_func.rsplit('.', 1) module_path = os.getcwd() ...
[ "def", "load_scoring_function", "(", "scoring_func", ")", ":", "if", "scoring_func", "and", "(", "\".\"", "in", "scoring_func", ")", ":", "try", ":", "module_name", ",", "func_name", "=", "scoring_func", ".", "rsplit", "(", "'.'", ",", "1", ")", "module_path...
converts mymodule.myfunc in the myfunc object itself so tpot receives a scoring function
[ "converts", "mymodule", ".", "myfunc", "in", "the", "myfunc", "object", "itself", "so", "tpot", "receives", "a", "scoring", "function" ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/driver.py#L493-L513
train
EpistasisLab/tpot
tpot/driver.py
tpot_driver
def tpot_driver(args): """Perform a TPOT run.""" if args.VERBOSITY >= 2: _print_args(args) input_data = _read_data_file(args) features = input_data.drop(args.TARGET_NAME, axis=1) training_features, testing_features, training_target, testing_target = \ train_test_split(features, inp...
python
def tpot_driver(args): """Perform a TPOT run.""" if args.VERBOSITY >= 2: _print_args(args) input_data = _read_data_file(args) features = input_data.drop(args.TARGET_NAME, axis=1) training_features, testing_features, training_target, testing_target = \ train_test_split(features, inp...
[ "def", "tpot_driver", "(", "args", ")", ":", "if", "args", ".", "VERBOSITY", ">=", "2", ":", "_print_args", "(", "args", ")", "input_data", "=", "_read_data_file", "(", "args", ")", "features", "=", "input_data", ".", "drop", "(", "args", ".", "TARGET_NA...
Perform a TPOT run.
[ "Perform", "a", "TPOT", "run", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/driver.py#L516-L574
train
EpistasisLab/tpot
tpot/builtins/feature_set_selector.py
FeatureSetSelector.fit
def fit(self, X, y=None): """Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to cla...
python
def fit(self, X, y=None): """Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to cla...
[ "def", "fit", "(", "self", ",", "X", ",", "y", "=", "None", ")", ":", "subset_df", "=", "pd", ".", "read_csv", "(", "self", ".", "subset_list", ",", "header", "=", "0", ",", "index_col", "=", "0", ")", "if", "isinstance", "(", "self", ".", "sel_s...
Fit FeatureSetSelector for feature selection Parameters ---------- X: array-like of shape (n_samples, n_features) The training input samples. y: array-like, shape (n_samples,) The target values (integers that correspond to classes in classification, real numbers ...
[ "Fit", "FeatureSetSelector", "for", "feature", "selection" ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_set_selector.py#L66-L114
train
EpistasisLab/tpot
tpot/builtins/feature_set_selector.py
FeatureSetSelector.transform
def transform(self, X): """Make subset after fit Parameters ---------- X: numpy ndarray, {n_samples, n_features} New data, where n_samples is the number of samples and n_features is the number of features. Returns ------- X_transformed: array-like, s...
python
def transform(self, X): """Make subset after fit Parameters ---------- X: numpy ndarray, {n_samples, n_features} New data, where n_samples is the number of samples and n_features is the number of features. Returns ------- X_transformed: array-like, s...
[ "def", "transform", "(", "self", ",", "X", ")", ":", "if", "isinstance", "(", "X", ",", "pd", ".", "DataFrame", ")", ":", "X_transformed", "=", "X", "[", "self", ".", "feat_list", "]", ".", "values", "elif", "isinstance", "(", "X", ",", "np", ".", ...
Make subset after fit Parameters ---------- X: numpy ndarray, {n_samples, n_features} New data, where n_samples is the number of samples and n_features is the number of features. Returns ------- X_transformed: array-like, shape (n_samples, n_features + 1) or...
[ "Make", "subset", "after", "fit" ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_set_selector.py#L116-L134
train
EpistasisLab/tpot
tpot/builtins/feature_set_selector.py
FeatureSetSelector._get_support_mask
def _get_support_mask(self): """ Get the boolean mask indicating which features are selected Returns ------- support : boolean array of shape [# input features] An element is True iff its corresponding feature is selected for retention. """ ...
python
def _get_support_mask(self): """ Get the boolean mask indicating which features are selected Returns ------- support : boolean array of shape [# input features] An element is True iff its corresponding feature is selected for retention. """ ...
[ "def", "_get_support_mask", "(", "self", ")", ":", "check_is_fitted", "(", "self", ",", "'feat_list_idx'", ")", "n_features", "=", "len", "(", "self", ".", "feature_names", ")", "mask", "=", "np", ".", "zeros", "(", "n_features", ",", "dtype", "=", "bool",...
Get the boolean mask indicating which features are selected Returns ------- support : boolean array of shape [# input features] An element is True iff its corresponding feature is selected for retention.
[ "Get", "the", "boolean", "mask", "indicating", "which", "features", "are", "selected", "Returns", "-------", "support", ":", "boolean", "array", "of", "shape", "[", "#", "input", "features", "]", "An", "element", "is", "True", "iff", "its", "corresponding", ...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/builtins/feature_set_selector.py#L136-L150
train
EpistasisLab/tpot
tpot/gp_deap.py
pick_two_individuals_eligible_for_crossover
def pick_two_individuals_eligible_for_crossover(population): """Pick two individuals from the population which can do crossover, that is, they share a primitive. Parameters ---------- population: array of individuals Returns ---------- tuple: (individual, individual) Two individual...
python
def pick_two_individuals_eligible_for_crossover(population): """Pick two individuals from the population which can do crossover, that is, they share a primitive. Parameters ---------- population: array of individuals Returns ---------- tuple: (individual, individual) Two individual...
[ "def", "pick_two_individuals_eligible_for_crossover", "(", "population", ")", ":", "primitives_by_ind", "=", "[", "set", "(", "[", "node", ".", "name", "for", "node", "in", "ind", "if", "isinstance", "(", "node", ",", "gp", ".", "Primitive", ")", "]", ")", ...
Pick two individuals from the population which can do crossover, that is, they share a primitive. Parameters ---------- population: array of individuals Returns ---------- tuple: (individual, individual) Two individuals which are not the same, but share at least one primitive. ...
[ "Pick", "two", "individuals", "from", "the", "population", "which", "can", "do", "crossover", "that", "is", "they", "share", "a", "primitive", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L41-L73
train
EpistasisLab/tpot
tpot/gp_deap.py
mutate_random_individual
def mutate_random_individual(population, toolbox): """Picks a random individual from the population, and performs mutation on a copy of it. Parameters ---------- population: array of individuals Returns ---------- individual: individual An individual which is a mutated copy of one ...
python
def mutate_random_individual(population, toolbox): """Picks a random individual from the population, and performs mutation on a copy of it. Parameters ---------- population: array of individuals Returns ---------- individual: individual An individual which is a mutated copy of one ...
[ "def", "mutate_random_individual", "(", "population", ",", "toolbox", ")", ":", "idx", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "len", "(", "population", ")", ")", "ind", "=", "population", "[", "idx", "]", "ind", ",", "=", "toolbox", ...
Picks a random individual from the population, and performs mutation on a copy of it. Parameters ---------- population: array of individuals Returns ---------- individual: individual An individual which is a mutated copy of one of the individuals in population, the returned ind...
[ "Picks", "a", "random", "individual", "from", "the", "population", "and", "performs", "mutation", "on", "a", "copy", "of", "it", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L76-L93
train
EpistasisLab/tpot
tpot/gp_deap.py
varOr
def varOr(population, toolbox, lambda_, cxpb, mutpb): """Part of an evolutionary algorithm applying only the variation part (crossover, mutation **or** reproduction). The modified individuals have their fitness invalidated. The individuals are cloned so returned population is independent of the input po...
python
def varOr(population, toolbox, lambda_, cxpb, mutpb): """Part of an evolutionary algorithm applying only the variation part (crossover, mutation **or** reproduction). The modified individuals have their fitness invalidated. The individuals are cloned so returned population is independent of the input po...
[ "def", "varOr", "(", "population", ",", "toolbox", ",", "lambda_", ",", "cxpb", ",", "mutpb", ")", ":", "offspring", "=", "[", "]", "for", "_", "in", "range", "(", "lambda_", ")", ":", "op_choice", "=", "np", ".", "random", ".", "random", "(", ")",...
Part of an evolutionary algorithm applying only the variation part (crossover, mutation **or** reproduction). The modified individuals have their fitness invalidated. The individuals are cloned so returned population is independent of the input population. :param population: A list of individuals to var...
[ "Part", "of", "an", "evolutionary", "algorithm", "applying", "only", "the", "variation", "part", "(", "crossover", "mutation", "**", "or", "**", "reproduction", ")", ".", "The", "modified", "individuals", "have", "their", "fitness", "invalidated", ".", "The", ...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L96-L149
train
EpistasisLab/tpot
tpot/gp_deap.py
initialize_stats_dict
def initialize_stats_dict(individual): ''' Initializes the stats dict for individual The statistics initialized are: 'generation': generation in which the individual was evaluated. Initialized as: 0 'mutation_count': number of mutation operations applied to the individual and its predecessor...
python
def initialize_stats_dict(individual): ''' Initializes the stats dict for individual The statistics initialized are: 'generation': generation in which the individual was evaluated. Initialized as: 0 'mutation_count': number of mutation operations applied to the individual and its predecessor...
[ "def", "initialize_stats_dict", "(", "individual", ")", ":", "individual", ".", "statistics", "[", "'generation'", "]", "=", "0", "individual", ".", "statistics", "[", "'mutation_count'", "]", "=", "0", "individual", ".", "statistics", "[", "'crossover_count'", ...
Initializes the stats dict for individual The statistics initialized are: 'generation': generation in which the individual was evaluated. Initialized as: 0 'mutation_count': number of mutation operations applied to the individual and its predecessor cumulatively. Initialized as: 0 'crossover...
[ "Initializes", "the", "stats", "dict", "for", "individual", "The", "statistics", "initialized", "are", ":", "generation", ":", "generation", "in", "which", "the", "individual", "was", "evaluated", ".", "Initialized", "as", ":", "0", "mutation_count", ":", "numbe...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L151-L171
train
EpistasisLab/tpot
tpot/gp_deap.py
eaMuPlusLambda
def eaMuPlusLambda(population, toolbox, mu, lambda_, cxpb, mutpb, ngen, pbar, stats=None, halloffame=None, verbose=0, per_generation_function=None): """This is the :math:`(\mu + \lambda)` evolutionary algorithm. :param population: A list of individuals. :param toolbox: A :class:`~deap.bas...
python
def eaMuPlusLambda(population, toolbox, mu, lambda_, cxpb, mutpb, ngen, pbar, stats=None, halloffame=None, verbose=0, per_generation_function=None): """This is the :math:`(\mu + \lambda)` evolutionary algorithm. :param population: A list of individuals. :param toolbox: A :class:`~deap.bas...
[ "def", "eaMuPlusLambda", "(", "population", ",", "toolbox", ",", "mu", ",", "lambda_", ",", "cxpb", ",", "mutpb", ",", "ngen", ",", "pbar", ",", "stats", "=", "None", ",", "halloffame", "=", "None", ",", "verbose", "=", "0", ",", "per_generation_function...
This is the :math:`(\mu + \lambda)` evolutionary algorithm. :param population: A list of individuals. :param toolbox: A :class:`~deap.base.Toolbox` that contains the evolution operators. :param mu: The number of individuals to select for the next generation. :param lambda\_: The numb...
[ "This", "is", "the", ":", "math", ":", "(", "\\", "mu", "+", "\\", "lambda", ")", "evolutionary", "algorithm", ".", ":", "param", "population", ":", "A", "list", "of", "individuals", ".", ":", "param", "toolbox", ":", "A", ":", "class", ":", "~deap",...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L174-L282
train
EpistasisLab/tpot
tpot/gp_deap.py
cxOnePoint
def cxOnePoint(ind1, ind2): """Randomly select in each individual and exchange each subtree with the point as root between each individual. :param ind1: First tree participating in the crossover. :param ind2: Second tree participating in the crossover. :returns: A tuple of two trees. """ # L...
python
def cxOnePoint(ind1, ind2): """Randomly select in each individual and exchange each subtree with the point as root between each individual. :param ind1: First tree participating in the crossover. :param ind2: Second tree participating in the crossover. :returns: A tuple of two trees. """ # L...
[ "def", "cxOnePoint", "(", "ind1", ",", "ind2", ")", ":", "# List all available primitive types in each individual", "types1", "=", "defaultdict", "(", "list", ")", "types2", "=", "defaultdict", "(", "list", ")", "for", "idx", ",", "node", "in", "enumerate", "(",...
Randomly select in each individual and exchange each subtree with the point as root between each individual. :param ind1: First tree participating in the crossover. :param ind2: Second tree participating in the crossover. :returns: A tuple of two trees.
[ "Randomly", "select", "in", "each", "individual", "and", "exchange", "each", "subtree", "with", "the", "point", "as", "root", "between", "each", "individual", ".", ":", "param", "ind1", ":", "First", "tree", "participating", "in", "the", "crossover", ".", ":...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L285-L314
train
EpistasisLab/tpot
tpot/gp_deap.py
mutNodeReplacement
def mutNodeReplacement(individual, pset): """Replaces a randomly chosen primitive from *individual* by a randomly chosen primitive no matter if it has the same number of arguments from the :attr:`pset` attribute of the individual. Parameters ---------- individual: DEAP individual A list ...
python
def mutNodeReplacement(individual, pset): """Replaces a randomly chosen primitive from *individual* by a randomly chosen primitive no matter if it has the same number of arguments from the :attr:`pset` attribute of the individual. Parameters ---------- individual: DEAP individual A list ...
[ "def", "mutNodeReplacement", "(", "individual", ",", "pset", ")", ":", "index", "=", "np", ".", "random", ".", "randint", "(", "0", ",", "len", "(", "individual", ")", ")", "node", "=", "individual", "[", "index", "]", "slice_", "=", "individual", ".",...
Replaces a randomly chosen primitive from *individual* by a randomly chosen primitive no matter if it has the same number of arguments from the :attr:`pset` attribute of the individual. Parameters ---------- individual: DEAP individual A list of pipeline operators and model parameters that c...
[ "Replaces", "a", "randomly", "chosen", "primitive", "from", "*", "individual", "*", "by", "a", "randomly", "chosen", "primitive", "no", "matter", "if", "it", "has", "the", "same", "number", "of", "arguments", "from", "the", ":", "attr", ":", "pset", "attri...
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L318-L379
train
EpistasisLab/tpot
tpot/gp_deap.py
_wrapped_cross_val_score
def _wrapped_cross_val_score(sklearn_pipeline, features, target, cv, scoring_function, sample_weight=None, groups=None, use_dask=False): """Fit estimator and compute scores for a given dataset split. Parameters ---------- sklearn_pipeline : pipe...
python
def _wrapped_cross_val_score(sklearn_pipeline, features, target, cv, scoring_function, sample_weight=None, groups=None, use_dask=False): """Fit estimator and compute scores for a given dataset split. Parameters ---------- sklearn_pipeline : pipe...
[ "def", "_wrapped_cross_val_score", "(", "sklearn_pipeline", ",", "features", ",", "target", ",", "cv", ",", "scoring_function", ",", "sample_weight", "=", "None", ",", "groups", "=", "None", ",", "use_dask", "=", "False", ")", ":", "sample_weight_dict", "=", "...
Fit estimator and compute scores for a given dataset split. Parameters ---------- sklearn_pipeline : pipeline object implementing 'fit' The object to use to fit the data. features : array-like of shape at least 2D The data to fit. target : array-like, optional, default: None ...
[ "Fit", "estimator", "and", "compute", "scores", "for", "a", "given", "dataset", "split", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/gp_deap.py#L383-L466
train
EpistasisLab/tpot
tpot/export_utils.py
get_by_name
def get_by_name(opname, operators): """Return operator class instance by name. Parameters ---------- opname: str Name of the sklearn class that belongs to a TPOT operator operators: list List of operator classes from operator library Returns ------- ret_op_class: class ...
python
def get_by_name(opname, operators): """Return operator class instance by name. Parameters ---------- opname: str Name of the sklearn class that belongs to a TPOT operator operators: list List of operator classes from operator library Returns ------- ret_op_class: class ...
[ "def", "get_by_name", "(", "opname", ",", "operators", ")", ":", "ret_op_classes", "=", "[", "op", "for", "op", "in", "operators", "if", "op", ".", "__name__", "==", "opname", "]", "if", "len", "(", "ret_op_classes", ")", "==", "0", ":", "raise", "Type...
Return operator class instance by name. Parameters ---------- opname: str Name of the sklearn class that belongs to a TPOT operator operators: list List of operator classes from operator library Returns ------- ret_op_class: class An operator class
[ "Return", "operator", "class", "instance", "by", "name", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L25-L51
train
EpistasisLab/tpot
tpot/export_utils.py
export_pipeline
def export_pipeline(exported_pipeline, operators, pset, impute=False, pipeline_score=None, random_state=None, data_file_path=''): """Generate source code for a TPOT Pipeline. Parameters ---------- exported_pipeline: deap.cr...
python
def export_pipeline(exported_pipeline, operators, pset, impute=False, pipeline_score=None, random_state=None, data_file_path=''): """Generate source code for a TPOT Pipeline. Parameters ---------- exported_pipeline: deap.cr...
[ "def", "export_pipeline", "(", "exported_pipeline", ",", "operators", ",", "pset", ",", "impute", "=", "False", ",", "pipeline_score", "=", "None", ",", "random_state", "=", "None", ",", "data_file_path", "=", "''", ")", ":", "# Unroll the nested function calls in...
Generate source code for a TPOT Pipeline. Parameters ---------- exported_pipeline: deap.creator.Individual The pipeline that is being exported operators: List of operator classes from operator library pipeline_score: Optional pipeline score to be saved to the exported file ...
[ "Generate", "source", "code", "for", "a", "TPOT", "Pipeline", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L54-L122
train
EpistasisLab/tpot
tpot/export_utils.py
expr_to_tree
def expr_to_tree(ind, pset): """Convert the unstructured DEAP pipeline into a tree data-structure. Parameters ---------- ind: deap.creator.Individual The pipeline that is being exported Returns ------- pipeline_tree: list List of operators in the current optimized pipeline ...
python
def expr_to_tree(ind, pset): """Convert the unstructured DEAP pipeline into a tree data-structure. Parameters ---------- ind: deap.creator.Individual The pipeline that is being exported Returns ------- pipeline_tree: list List of operators in the current optimized pipeline ...
[ "def", "expr_to_tree", "(", "ind", ",", "pset", ")", ":", "def", "prim_to_list", "(", "prim", ",", "args", ")", ":", "if", "isinstance", "(", "prim", ",", "deap", ".", "gp", ".", "Terminal", ")", ":", "if", "prim", ".", "name", "in", "pset", ".", ...
Convert the unstructured DEAP pipeline into a tree data-structure. Parameters ---------- ind: deap.creator.Individual The pipeline that is being exported Returns ------- pipeline_tree: list List of operators in the current optimized pipeline EXAMPLE: pipeline: ...
[ "Convert", "the", "unstructured", "DEAP", "pipeline", "into", "a", "tree", "data", "-", "structure", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L125-L165
train
EpistasisLab/tpot
tpot/export_utils.py
generate_import_code
def generate_import_code(pipeline, operators, impute=False): """Generate all library import calls for use in TPOT.export(). Parameters ---------- pipeline: List List of operators in the current optimized pipeline operators: List of operator class from operator library impute : b...
python
def generate_import_code(pipeline, operators, impute=False): """Generate all library import calls for use in TPOT.export(). Parameters ---------- pipeline: List List of operators in the current optimized pipeline operators: List of operator class from operator library impute : b...
[ "def", "generate_import_code", "(", "pipeline", ",", "operators", ",", "impute", "=", "False", ")", ":", "def", "merge_imports", "(", "old_dict", ",", "new_dict", ")", ":", "# Key is a module name", "for", "key", "in", "new_dict", ".", "keys", "(", ")", ":",...
Generate all library import calls for use in TPOT.export(). Parameters ---------- pipeline: List List of operators in the current optimized pipeline operators: List of operator class from operator library impute : bool Whether to impute new values in the feature set. Re...
[ "Generate", "all", "library", "import", "calls", "for", "use", "in", "TPOT", ".", "export", "()", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L168-L220
train
EpistasisLab/tpot
tpot/export_utils.py
generate_pipeline_code
def generate_pipeline_code(pipeline_tree, operators): """Generate code specific to the construction of the sklearn Pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the sklearn pipeline """ ...
python
def generate_pipeline_code(pipeline_tree, operators): """Generate code specific to the construction of the sklearn Pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the sklearn pipeline """ ...
[ "def", "generate_pipeline_code", "(", "pipeline_tree", ",", "operators", ")", ":", "steps", "=", "_process_operator", "(", "pipeline_tree", ",", "operators", ")", "pipeline_text", "=", "\"make_pipeline(\\n{STEPS}\\n)\"", ".", "format", "(", "STEPS", "=", "_indent", ...
Generate code specific to the construction of the sklearn Pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the sklearn pipeline
[ "Generate", "code", "specific", "to", "the", "construction", "of", "the", "sklearn", "Pipeline", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L275-L290
train
EpistasisLab/tpot
tpot/export_utils.py
generate_export_pipeline_code
def generate_export_pipeline_code(pipeline_tree, operators): """Generate code specific to the construction of the sklearn Pipeline for export_pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the ...
python
def generate_export_pipeline_code(pipeline_tree, operators): """Generate code specific to the construction of the sklearn Pipeline for export_pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the ...
[ "def", "generate_export_pipeline_code", "(", "pipeline_tree", ",", "operators", ")", ":", "steps", "=", "_process_operator", "(", "pipeline_tree", ",", "operators", ")", "# number of steps in a pipeline", "num_step", "=", "len", "(", "steps", ")", "if", "num_step", ...
Generate code specific to the construction of the sklearn Pipeline for export_pipeline. Parameters ---------- pipeline_tree: list List of operators in the current optimized pipeline Returns ------- Source code for the sklearn pipeline
[ "Generate", "code", "specific", "to", "the", "construction", "of", "the", "sklearn", "Pipeline", "for", "export_pipeline", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L293-L315
train
EpistasisLab/tpot
tpot/export_utils.py
_indent
def _indent(text, amount): """Indent a multiline string by some number of spaces. Parameters ---------- text: str The text to be indented amount: int The number of spaces to indent the text Returns ------- indented_text """ indentation = amount * ' ' return...
python
def _indent(text, amount): """Indent a multiline string by some number of spaces. Parameters ---------- text: str The text to be indented amount: int The number of spaces to indent the text Returns ------- indented_text """ indentation = amount * ' ' return...
[ "def", "_indent", "(", "text", ",", "amount", ")", ":", "indentation", "=", "amount", "*", "' '", "return", "indentation", "+", "(", "'\\n'", "+", "indentation", ")", ".", "join", "(", "text", ".", "split", "(", "'\\n'", ")", ")" ]
Indent a multiline string by some number of spaces. Parameters ---------- text: str The text to be indented amount: int The number of spaces to indent the text Returns ------- indented_text
[ "Indent", "a", "multiline", "string", "by", "some", "number", "of", "spaces", "." ]
b626271e6b5896a73fb9d7d29bebc7aa9100772e
https://github.com/EpistasisLab/tpot/blob/b626271e6b5896a73fb9d7d29bebc7aa9100772e/tpot/export_utils.py#L347-L363
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
Page.next
def next(self): """Get the next value in the page.""" item = six.next(self._item_iter) result = self._item_to_value(self._parent, item) # Since we've successfully got the next value from the # iterator, we update the number of remaining. self._remaining -= 1 retur...
python
def next(self): """Get the next value in the page.""" item = six.next(self._item_iter) result = self._item_to_value(self._parent, item) # Since we've successfully got the next value from the # iterator, we update the number of remaining. self._remaining -= 1 retur...
[ "def", "next", "(", "self", ")", ":", "item", "=", "six", ".", "next", "(", "self", ".", "_item_iter", ")", "result", "=", "self", ".", "_item_to_value", "(", "self", ".", "_parent", ",", "item", ")", "# Since we've successfully got the next value from the", ...
Get the next value in the page.
[ "Get", "the", "next", "value", "in", "the", "page", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L122-L129
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
HTTPIterator._verify_params
def _verify_params(self): """Verifies the parameters don't use any reserved parameter. Raises: ValueError: If a reserved parameter is used. """ reserved_in_use = self._RESERVED_PARAMS.intersection(self.extra_params) if reserved_in_use: raise ValueError("U...
python
def _verify_params(self): """Verifies the parameters don't use any reserved parameter. Raises: ValueError: If a reserved parameter is used. """ reserved_in_use = self._RESERVED_PARAMS.intersection(self.extra_params) if reserved_in_use: raise ValueError("U...
[ "def", "_verify_params", "(", "self", ")", ":", "reserved_in_use", "=", "self", ".", "_RESERVED_PARAMS", ".", "intersection", "(", "self", ".", "extra_params", ")", "if", "reserved_in_use", ":", "raise", "ValueError", "(", "\"Using a reserved parameter\"", ",", "r...
Verifies the parameters don't use any reserved parameter. Raises: ValueError: If a reserved parameter is used.
[ "Verifies", "the", "parameters", "don", "t", "use", "any", "reserved", "parameter", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L343-L351
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
HTTPIterator._next_page
def _next_page(self): """Get the next page in the iterator. Returns: Optional[Page]: The next page in the iterator or :data:`None` if there are no pages left. """ if self._has_next_page(): response = self._get_next_page_response() item...
python
def _next_page(self): """Get the next page in the iterator. Returns: Optional[Page]: The next page in the iterator or :data:`None` if there are no pages left. """ if self._has_next_page(): response = self._get_next_page_response() item...
[ "def", "_next_page", "(", "self", ")", ":", "if", "self", ".", "_has_next_page", "(", ")", ":", "response", "=", "self", ".", "_get_next_page_response", "(", ")", "items", "=", "response", ".", "get", "(", "self", ".", "_items_key", ",", "(", ")", ")",...
Get the next page in the iterator. Returns: Optional[Page]: The next page in the iterator or :data:`None` if there are no pages left.
[ "Get", "the", "next", "page", "in", "the", "iterator", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L353-L368
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
HTTPIterator._get_query_params
def _get_query_params(self): """Getter for query parameters for the next request. Returns: dict: A dictionary of query parameters. """ result = {} if self.next_page_token is not None: result[self._PAGE_TOKEN] = self.next_page_token if self.max_res...
python
def _get_query_params(self): """Getter for query parameters for the next request. Returns: dict: A dictionary of query parameters. """ result = {} if self.next_page_token is not None: result[self._PAGE_TOKEN] = self.next_page_token if self.max_res...
[ "def", "_get_query_params", "(", "self", ")", ":", "result", "=", "{", "}", "if", "self", ".", "next_page_token", "is", "not", "None", ":", "result", "[", "self", ".", "_PAGE_TOKEN", "]", "=", "self", ".", "next_page_token", "if", "self", ".", "max_resul...
Getter for query parameters for the next request. Returns: dict: A dictionary of query parameters.
[ "Getter", "for", "query", "parameters", "for", "the", "next", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L385-L397
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
HTTPIterator._get_next_page_response
def _get_next_page_response(self): """Requests the next page from the path provided. Returns: dict: The parsed JSON response of the next page's contents. Raises: ValueError: If the HTTP method is not ``GET`` or ``POST``. """ params = self._get_query_para...
python
def _get_next_page_response(self): """Requests the next page from the path provided. Returns: dict: The parsed JSON response of the next page's contents. Raises: ValueError: If the HTTP method is not ``GET`` or ``POST``. """ params = self._get_query_para...
[ "def", "_get_next_page_response", "(", "self", ")", ":", "params", "=", "self", ".", "_get_query_params", "(", ")", "if", "self", ".", "_HTTP_METHOD", "==", "\"GET\"", ":", "return", "self", ".", "api_request", "(", "method", "=", "self", ".", "_HTTP_METHOD"...
Requests the next page from the path provided. Returns: dict: The parsed JSON response of the next page's contents. Raises: ValueError: If the HTTP method is not ``GET`` or ``POST``.
[ "Requests", "the", "next", "page", "from", "the", "path", "provided", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L399-L418
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
_GAXIterator._next_page
def _next_page(self): """Get the next page in the iterator. Wraps the response from the :class:`~google.gax.PageIterator` in a :class:`Page` instance and captures some state at each page. Returns: Optional[Page]: The next page in the iterator or :data:`None` if ...
python
def _next_page(self): """Get the next page in the iterator. Wraps the response from the :class:`~google.gax.PageIterator` in a :class:`Page` instance and captures some state at each page. Returns: Optional[Page]: The next page in the iterator or :data:`None` if ...
[ "def", "_next_page", "(", "self", ")", ":", "try", ":", "items", "=", "six", ".", "next", "(", "self", ".", "_gax_page_iter", ")", "page", "=", "Page", "(", "self", ",", "items", ",", "self", ".", "item_to_value", ")", "self", ".", "next_page_token", ...
Get the next page in the iterator. Wraps the response from the :class:`~google.gax.PageIterator` in a :class:`Page` instance and captures some state at each page. Returns: Optional[Page]: The next page in the iterator or :data:`None` if there are no pages left.
[ "Get", "the", "next", "page", "in", "the", "iterator", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L445-L461
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
GRPCIterator._next_page
def _next_page(self): """Get the next page in the iterator. Returns: Page: The next page in the iterator or :data:`None` if there are no pages left. """ if not self._has_next_page(): return None if self.next_page_token is not None: ...
python
def _next_page(self): """Get the next page in the iterator. Returns: Page: The next page in the iterator or :data:`None` if there are no pages left. """ if not self._has_next_page(): return None if self.next_page_token is not None: ...
[ "def", "_next_page", "(", "self", ")", ":", "if", "not", "self", ".", "_has_next_page", "(", ")", ":", "return", "None", "if", "self", ".", "next_page_token", "is", "not", "None", ":", "setattr", "(", "self", ".", "_request", ",", "self", ".", "_reques...
Get the next page in the iterator. Returns: Page: The next page in the iterator or :data:`None` if there are no pages left.
[ "Get", "the", "next", "page", "in", "the", "iterator", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L513-L532
train
googleapis/google-cloud-python
api_core/google/api_core/page_iterator.py
GRPCIterator._has_next_page
def _has_next_page(self): """Determines whether or not there are more pages with results. Returns: bool: Whether the iterator has more pages. """ if self.page_number == 0: return True if self.max_results is not None: if self.num_results >= se...
python
def _has_next_page(self): """Determines whether or not there are more pages with results. Returns: bool: Whether the iterator has more pages. """ if self.page_number == 0: return True if self.max_results is not None: if self.num_results >= se...
[ "def", "_has_next_page", "(", "self", ")", ":", "if", "self", ".", "page_number", "==", "0", ":", "return", "True", "if", "self", ".", "max_results", "is", "not", "None", ":", "if", "self", ".", "num_results", ">=", "self", ".", "max_results", ":", "re...
Determines whether or not there are more pages with results. Returns: bool: Whether the iterator has more pages.
[ "Determines", "whether", "or", "not", "there", "are", "more", "pages", "with", "results", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/page_iterator.py#L534-L549
train
googleapis/google-cloud-python
firestore/google/cloud/firestore_v1beta1/order.py
Order.compare
def compare(cls, left, right): """ Main comparison function for all Firestore types. @return -1 is left < right, 0 if left == right, otherwise 1 """ # First compare the types. leftType = TypeOrder.from_value(left).value rightType = TypeOrder.from_value(right).valu...
python
def compare(cls, left, right): """ Main comparison function for all Firestore types. @return -1 is left < right, 0 if left == right, otherwise 1 """ # First compare the types. leftType = TypeOrder.from_value(left).value rightType = TypeOrder.from_value(right).valu...
[ "def", "compare", "(", "cls", ",", "left", ",", "right", ")", ":", "# First compare the types.", "leftType", "=", "TypeOrder", ".", "from_value", "(", "left", ")", ".", "value", "rightType", "=", "TypeOrder", ".", "from_value", "(", "right", ")", ".", "val...
Main comparison function for all Firestore types. @return -1 is left < right, 0 if left == right, otherwise 1
[ "Main", "comparison", "function", "for", "all", "Firestore", "types", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/firestore/google/cloud/firestore_v1beta1/order.py#L62-L101
train
googleapis/google-cloud-python
vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py
ImageAnnotatorClient.batch_annotate_files
def batch_annotate_files( self, requests, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Service that performs image detection and annotation for a batch of files. Now only "applica...
python
def batch_annotate_files( self, requests, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Service that performs image detection and annotation for a batch of files. Now only "applica...
[ "def", "batch_annotate_files", "(", "self", ",", "requests", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", ...
Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported. This service will extract at most the first 10 frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation ...
[ "Service", "that", "performs", "image", "detection", "and", "annotation", "for", "a", "batch", "of", "files", ".", "Now", "only", "application", "/", "pdf", "image", "/", "tiff", "and", "image", "/", "gif", "are", "supported", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py#L239-L303
train
googleapis/google-cloud-python
vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py
ImageAnnotatorClient.async_batch_annotate_images
def async_batch_annotate_images( self, requests, output_config, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Run asynchronous image detection and annotation for a list of images. ...
python
def async_batch_annotate_images( self, requests, output_config, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Run asynchronous image detection and annotation for a list of images. ...
[ "def", "async_batch_annotate_images", "(", "self", ",", "requests", ",", "output_config", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "met...
Run asynchronous image detection and annotation for a list of images. Progress and results can be retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateImag...
[ "Run", "asynchronous", "image", "detection", "and", "annotation", "for", "a", "list", "of", "images", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py#L305-L399
train
googleapis/google-cloud-python
vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py
ImageAnnotatorClient.async_batch_annotate_files
def async_batch_annotate_files( self, requests, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Run asynchronous image detection and annotation for a list of generic files, such as P...
python
def async_batch_annotate_files( self, requests, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """ Run asynchronous image detection and annotation for a list of generic files, such as P...
[ "def", "async_batch_annotate_files", "(", "self", ",", "requests", ",", "retry", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ",", "timeout", "=", "google", ".", "api_core", ".", "gapic_v1", ".", "method", ".", "DEFAULT", ...
Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains ``...
[ "Run", "asynchronous", "image", "detection", "and", "annotation", "for", "a", "list", "of", "generic", "files", "such", "as", "PDF", "files", "which", "may", "contain", "multiple", "pages", "and", "multiple", "images", "per", "page", ".", "Progress", "and", ...
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/vision/google/cloud/vision_v1p4beta1/gapic/image_annotator_client.py#L401-L479
train
googleapis/google-cloud-python
bigquery/google/cloud/bigquery/__init__.py
load_ipython_extension
def load_ipython_extension(ipython): """Called by IPython when this module is loaded as an IPython extension.""" from google.cloud.bigquery.magics import _cell_magic ipython.register_magic_function( _cell_magic, magic_kind="cell", magic_name="bigquery" )
python
def load_ipython_extension(ipython): """Called by IPython when this module is loaded as an IPython extension.""" from google.cloud.bigquery.magics import _cell_magic ipython.register_magic_function( _cell_magic, magic_kind="cell", magic_name="bigquery" )
[ "def", "load_ipython_extension", "(", "ipython", ")", ":", "from", "google", ".", "cloud", ".", "bigquery", ".", "magics", "import", "_cell_magic", "ipython", ".", "register_magic_function", "(", "_cell_magic", ",", "magic_kind", "=", "\"cell\"", ",", "magic_name"...
Called by IPython when this module is loaded as an IPython extension.
[ "Called", "by", "IPython", "when", "this", "module", "is", "loaded", "as", "an", "IPython", "extension", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/bigquery/google/cloud/bigquery/__init__.py#L131-L137
train
googleapis/google-cloud-python
api_core/google/api_core/exceptions.py
from_http_status
def from_http_status(status_code, message, **kwargs): """Create a :class:`GoogleAPICallError` from an HTTP status code. Args: status_code (int): The HTTP status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICallError` ...
python
def from_http_status(status_code, message, **kwargs): """Create a :class:`GoogleAPICallError` from an HTTP status code. Args: status_code (int): The HTTP status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICallError` ...
[ "def", "from_http_status", "(", "status_code", ",", "message", ",", "*", "*", "kwargs", ")", ":", "error_class", "=", "exception_class_for_http_status", "(", "status_code", ")", "error", "=", "error_class", "(", "message", ",", "*", "*", "kwargs", ")", "if", ...
Create a :class:`GoogleAPICallError` from an HTTP status code. Args: status_code (int): The HTTP status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICallError` constructor. Returns: GoogleAPICallError: An in...
[ "Create", "a", ":", "class", ":", "GoogleAPICallError", "from", "an", "HTTP", "status", "code", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/exceptions.py#L362-L381
train
googleapis/google-cloud-python
api_core/google/api_core/exceptions.py
from_http_response
def from_http_response(response): """Create a :class:`GoogleAPICallError` from a :class:`requests.Response`. Args: response (requests.Response): The HTTP response. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`, with the mess...
python
def from_http_response(response): """Create a :class:`GoogleAPICallError` from a :class:`requests.Response`. Args: response (requests.Response): The HTTP response. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`, with the mess...
[ "def", "from_http_response", "(", "response", ")", ":", "try", ":", "payload", "=", "response", ".", "json", "(", ")", "except", "ValueError", ":", "payload", "=", "{", "\"error\"", ":", "{", "\"message\"", ":", "response", ".", "text", "or", "\"unknown er...
Create a :class:`GoogleAPICallError` from a :class:`requests.Response`. Args: response (requests.Response): The HTTP response. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`, with the message and errors populated from...
[ "Create", "a", ":", "class", ":", "GoogleAPICallError", "from", "a", ":", "class", ":", "requests", ".", "Response", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/exceptions.py#L384-L410
train
googleapis/google-cloud-python
api_core/google/api_core/exceptions.py
from_grpc_status
def from_grpc_status(status_code, message, **kwargs): """Create a :class:`GoogleAPICallError` from a :class:`grpc.StatusCode`. Args: status_code (grpc.StatusCode): The gRPC status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICal...
python
def from_grpc_status(status_code, message, **kwargs): """Create a :class:`GoogleAPICallError` from a :class:`grpc.StatusCode`. Args: status_code (grpc.StatusCode): The gRPC status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICal...
[ "def", "from_grpc_status", "(", "status_code", ",", "message", ",", "*", "*", "kwargs", ")", ":", "error_class", "=", "exception_class_for_grpc_status", "(", "status_code", ")", "error", "=", "error_class", "(", "message", ",", "*", "*", "kwargs", ")", "if", ...
Create a :class:`GoogleAPICallError` from a :class:`grpc.StatusCode`. Args: status_code (grpc.StatusCode): The gRPC status code. message (str): The exception message. kwargs: Additional arguments passed to the :class:`GoogleAPICallError` constructor. Returns: Google...
[ "Create", "a", ":", "class", ":", "GoogleAPICallError", "from", "a", ":", "class", ":", "grpc", ".", "StatusCode", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/exceptions.py#L425-L444
train
googleapis/google-cloud-python
api_core/google/api_core/exceptions.py
from_grpc_error
def from_grpc_error(rpc_exc): """Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`. Args: rpc_exc (grpc.RpcError): The gRPC error. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`. """ if isinstance(rpc...
python
def from_grpc_error(rpc_exc): """Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`. Args: rpc_exc (grpc.RpcError): The gRPC error. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`. """ if isinstance(rpc...
[ "def", "from_grpc_error", "(", "rpc_exc", ")", ":", "if", "isinstance", "(", "rpc_exc", ",", "grpc", ".", "Call", ")", ":", "return", "from_grpc_status", "(", "rpc_exc", ".", "code", "(", ")", ",", "rpc_exc", ".", "details", "(", ")", ",", "errors", "=...
Create a :class:`GoogleAPICallError` from a :class:`grpc.RpcError`. Args: rpc_exc (grpc.RpcError): The gRPC error. Returns: GoogleAPICallError: An instance of the appropriate subclass of :class:`GoogleAPICallError`.
[ "Create", "a", ":", "class", ":", "GoogleAPICallError", "from", "a", ":", "class", ":", "grpc", ".", "RpcError", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/api_core/google/api_core/exceptions.py#L447-L462
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/_http.py
_request
def _request(http, project, method, data, base_url): """Make a request over the Http transport to the Cloud Datastore API. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to make the request for. :type method: str...
python
def _request(http, project, method, data, base_url): """Make a request over the Http transport to the Cloud Datastore API. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to make the request for. :type method: str...
[ "def", "_request", "(", "http", ",", "project", ",", "method", ",", "data", ",", "base_url", ")", ":", "headers", "=", "{", "\"Content-Type\"", ":", "\"application/x-protobuf\"", ",", "\"User-Agent\"", ":", "connection_module", ".", "DEFAULT_USER_AGENT", ",", "c...
Make a request over the Http transport to the Cloud Datastore API. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to make the request for. :type method: str :param method: The API call method name (ie, ``runQuery...
[ "Make", "a", "request", "over", "the", "Http", "transport", "to", "the", "Cloud", "Datastore", "API", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L38-L78
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/_http.py
_rpc
def _rpc(http, project, method, base_url, request_pb, response_pb_cls): """Make a protobuf RPC request. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to connect to. This is usually your project na...
python
def _rpc(http, project, method, base_url, request_pb, response_pb_cls): """Make a protobuf RPC request. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to connect to. This is usually your project na...
[ "def", "_rpc", "(", "http", ",", "project", ",", "method", ",", "base_url", ",", "request_pb", ",", "response_pb_cls", ")", ":", "req_data", "=", "request_pb", ".", "SerializeToString", "(", ")", "response", "=", "_request", "(", "http", ",", "project", ",...
Make a protobuf RPC request. :type http: :class:`requests.Session` :param http: HTTP object to make requests. :type project: str :param project: The project to connect to. This is usually your project name in the cloud console. :type method: str :param method: The name of ...
[ "Make", "a", "protobuf", "RPC", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L81-L110
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/_http.py
build_api_url
def build_api_url(project, method, base_url): """Construct the URL for a particular API call. This method is used internally to come up with the URL to use when making RPCs to the Cloud Datastore API. :type project: str :param project: The project to connect to. This is usually...
python
def build_api_url(project, method, base_url): """Construct the URL for a particular API call. This method is used internally to come up with the URL to use when making RPCs to the Cloud Datastore API. :type project: str :param project: The project to connect to. This is usually...
[ "def", "build_api_url", "(", "project", ",", "method", ",", "base_url", ")", ":", "return", "API_URL_TEMPLATE", ".", "format", "(", "api_base", "=", "base_url", ",", "api_version", "=", "API_VERSION", ",", "project", "=", "project", ",", "method", "=", "meth...
Construct the URL for a particular API call. This method is used internally to come up with the URL to use when making RPCs to the Cloud Datastore API. :type project: str :param project: The project to connect to. This is usually your project name in the cloud console. :type m...
[ "Construct", "the", "URL", "for", "a", "particular", "API", "call", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L113-L134
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/_http.py
HTTPDatastoreAPI.lookup
def lookup(self, project_id, keys, read_options=None): """Perform a ``lookup`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. :type keys: List[.entity_pb2.Key] :para...
python
def lookup(self, project_id, keys, read_options=None): """Perform a ``lookup`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. :type keys: List[.entity_pb2.Key] :para...
[ "def", "lookup", "(", "self", ",", "project_id", ",", "keys", ",", "read_options", "=", "None", ")", ":", "request_pb", "=", "_datastore_pb2", ".", "LookupRequest", "(", "project_id", "=", "project_id", ",", "read_options", "=", "read_options", ",", "keys", ...
Perform a ``lookup`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. :type keys: List[.entity_pb2.Key] :param keys: The keys to retrieve from the datastore. :type re...
[ "Perform", "a", "lookup", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L149-L177
train
googleapis/google-cloud-python
datastore/google/cloud/datastore/_http.py
HTTPDatastoreAPI.run_query
def run_query( self, project_id, partition_id, read_options=None, query=None, gql_query=None ): """Perform a ``runQuery`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. ...
python
def run_query( self, project_id, partition_id, read_options=None, query=None, gql_query=None ): """Perform a ``runQuery`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. ...
[ "def", "run_query", "(", "self", ",", "project_id", ",", "partition_id", ",", "read_options", "=", "None", ",", "query", "=", "None", ",", "gql_query", "=", "None", ")", ":", "request_pb", "=", "_datastore_pb2", ".", "RunQueryRequest", "(", "project_id", "="...
Perform a ``runQuery`` request. :type project_id: str :param project_id: The project to connect to. This is usually your project name in the cloud console. :type partition_id: :class:`.entity_pb2.PartitionId` :param partition_id: Partition ID corresponding to...
[ "Perform", "a", "runQuery", "request", "." ]
85e80125a59cb10f8cb105f25ecc099e4b940b50
https://github.com/googleapis/google-cloud-python/blob/85e80125a59cb10f8cb105f25ecc099e4b940b50/datastore/google/cloud/datastore/_http.py#L179-L222
train