"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_by_folder)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
" Note: This method looks at the folder immediately after `self.path` for `valid` and `train`.
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"jekyll_note(\"This method looks at the folder immediately after `self.path` for `valid` and `train`.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> split_by_idx
(`valid_idx`:`Collection`\\[`int`\\]) → `ItemLists`\n",
"\n",
"Split the data according to the indexes in `valid_idx`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_by_idx)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> split_by_idxs
(`train_idx`, `valid_idx`)\n",
"\n",
"Split the data between `train_idx` and `valid_idx`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_by_idxs)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> split_by_list
(`train`, `valid`)\n",
"\n",
"Split the data between `train` and `valid`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_by_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"split_by_valid_func
[source]
\n",
"\n",
"> split_by_valid_func
(`func`:`Callable`) → `ItemLists`\n",
"\n",
"Split the data by result of `func` (which returns `True` for validation set) "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_by_valid_func)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> split_from_df
(`col`:`Union`\\[`int`, `Collection`\\[`int`\\], `str`, `StrList`\\]=`2`)\n",
"\n",
"Split the data from the `col` in the dataframe in `self.xtra`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.split_from_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
" Warning: This method assumes the data has been created from a csv file or a dataframe.
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"jekyll_warn(\"This method assumes the data has been created from a csv file or a dataframe.\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 3: Label the inputs"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To label your inputs, use one of the following functions. Note that even if it's not in the documented arguments, you can always pass a `label_cls` that will be used to create those labels (the default is the one from your input [`ItemList`](/data_block.html#ItemList), and if there is none, it will go to [`CategoryList`](/data_block.html#CategoryList), [`MultiCategoryList`](/data_block.html#MultiCategoryList) or [`FloatList`](/data_block.html#FloatList) depending on the type of the labels)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_from_list
(`labels`:`Iterator`, `kwargs`) → `LabelList`\n",
"\n",
"Label `self.items` with `labels` using `label_cls` "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_from_list)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_from_df
(`cols`:`Union`\\[`int`, `Collection`\\[`int`\\], `str`, `StrList`\\]=`1`, `kwargs`)\n",
"\n",
"Label `self.items` from the values in `cols` in `self.xtra`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_from_df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
" Warning: This method assumes the data has been created from a csv file or a dataframe.
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"jekyll_warn(\"This method assumes the data has been created from a csv file or a dataframe.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_const
(`const`:`Any`=`0`, `kwargs`) → `LabelList`\n",
"\n",
"Label every item with `const`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_const)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"label_from_folder
[source]
\n",
"\n",
"> label_from_folder
(`kwargs`) → `LabelList`\n",
"\n",
"Give a label to each filename depending on its folder. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_from_folder)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
" Note: This method looks at the last subfolder in the path to determine the classes.
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"jekyll_note(\"This method looks at the last subfolder in the path to determine the classes.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_from_func
(`func`:`Callable`, `kwargs`) → `LabelList`\n",
"\n",
"Apply `func` to every input to get its label. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_from_func)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_from_re
(`pat`:`str`, `full_path`:`bool`=`False`, `kwargs`) → `LabelList`\n",
"\n",
"Apply the re in `pat` to determine the label of every filename. If `full_path`, search in the full name. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_from_re)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"class
CategoryList
[source]
\n",
"\n",
"> CategoryList
(`items`:`Iterator`, `classes`:`Collection`=`None`, `processor`:[`PreProcessor`](/data_block.html#PreProcessor)=`None`, `kwargs`) :: [`CategoryListBase`](/data_block.html#CategoryListBase)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryList, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`ItemList`](/data_block.html#ItemList) suitable for storing labels in `items` belonging to `classes`. If `None` are passed, `classes` will be determined by the unique different labels. `processor` will default to [`CategoryProcessor`](/data_block.html#CategoryProcessor)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"class
MultiCategoryList
[source]
\n",
"\n",
"> MultiCategoryList
(`items`:`Iterator`, `classes`:`Collection`=`None`, `processor`:[`PreProcessor`](/data_block.html#PreProcessor)=`None`, `sep`:`str`=`None`, `kwargs`) :: [`CategoryListBase`](/data_block.html#CategoryListBase)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(MultiCategoryList, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`ItemList`](/data_block.html#ItemList) suitable for storing list of labels in `items` belonging to `classes`. If `None` are passed, `classes` will be determined by the unique different labels. `sep` is used to split the content of `items` in a list of labels."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> FloatList
(`items`:`Iterator`, `log`:`bool`=`False`, `kwargs`) :: [`ItemList`](/data_block.html#ItemList)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(FloatList, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`ItemList`](/data_block.html#ItemList) suitable for storing the floats in items for regression. Will add a `log` if this flag is `True`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Invisible step: preprocessing"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This isn't seen tehre in the API, but if you passed a `processor` (or a list of them) in your initial [`ItemList`](/data_block.html#ItemList) during step 1, it will be applied here. A processor is a transformation that is applied to all the inputs once and for all, with a state computed on the training set that is then applied without modification on the validation set (and maybe the test set). For instance, it can be processing texts to tokenize then numericalize them. In that case we want the validation set to be numericalized with exactly the same vocabulary as the training set.\n",
"\n",
"Another example is in tabular data, where we fill missing values with (for instance) the median computed on the training set. That statistic is stored in the inner state of the [`PreProcessor`](/data_block.html#PreProcessor) and applied on the validation set.\n",
"\n",
"This is the generic class for all processors."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"class
PreProcessor
[source]
\n",
"\n",
"> PreProcessor
()"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(PreProcessor, title_level=3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process_one
(`item`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(PreProcessor.process_one)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Process one `item`. This method needs to be written in any subclass."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process
(`ds`:`Collection`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(PreProcessor.process)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Process a dataset. This default to apply `process_one` on every `item` of `ds`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"class
CategoryProcessor
[source]
\n",
"\n",
"> CategoryProcessor
(`classes`:`Collection`=`None`) :: [`PreProcessor`](/data_block.html#PreProcessor)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryProcessor, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`PreProcessor`](/data_block.html#PreProcessor) that will convert labels to codes usings `classes` (if passed) in a single classificatio problem."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"class
MultiCategoryProcessor
[source]
\n",
"\n",
"> MultiCategoryProcessor
(`classes`:`Collection`=`None`) :: [`CategoryProcessor`](/data_block.html#CategoryProcessor)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(MultiCategoryProcessor, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[`PreProcessor`](/data_block.html#PreProcessor) that will convert labels to codes usings `classes` (if passed) in a single multi-classificatio problem."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Optional steps"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Add transforms"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Transforms differ from processors in the sense they are applied on the fly when we grab one item. They also may change each time we ask for the same item in the case of random transforms."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> transform
(`tfms`:`Optional`\\[`Tuple`\\[`Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\], `Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\]\\]\\]=`(None, None)`, `kwargs`)\n",
"\n",
"Set `tfms` to be applied to the train and validation set. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.transform)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is primary for the vision application. The `kwargs` are the one expected by the type of transforms you pass. `tfm_y` is among them and if set to `True`, the transforms will be applied to input and target."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Add a test set"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To add a test set, you can use one of the two following methods."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> add_test
(`items`:`Iterator`, `label`:`Any`=`None`)\n",
"\n",
"Add test set containing items from `items` and an arbitrary `label` "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.add_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
" Note: Here `items` can be an `ItemList` or a collection.
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"jekyll_note(\"Here `items` can be an `ItemList` or a collection.\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> add_test_folder
(`test_folder`:`str`=`'test'`, `label`:`Any`=`None`)\n",
"\n",
"Add test set containing items from folder `test_folder` and an arbitrary `label`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.add_test_folder)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 4: convert to a [`DataBunch`](/basic_data.html#DataBunch)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This last step is usually pretty straightforward. You just have to include all the arguments we pass to [`DataBunch.create`](/basic_data.html#DataBunch.create) (`bs`, `num_workers`, `collate_fn`). The class called to create a [`DataBunch`](/basic_data.html#DataBunch) is set in the `_bunch` attribute of the inputs of the training set if you need to modify it. Normally, the various subclasses we showed before handle that for you."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> databunch
(`path`:`PathOrStr`=`None`, `kwargs`) → `ImageDataBunch`\n",
"\n",
"Create an [`DataBunch`](/basic_data.html#DataBunch) from self, `path` will override `self.path`, `kwargs` are passed to [`DataBunch.create`](/basic_data.html#DataBunch.create). "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.databunch)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Inner classes"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> LabelList
(`x`:[`ItemList`](/data_block.html#ItemList), `y`:[`ItemList`](/data_block.html#ItemList), `tfms`:`Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\]=`None`, `tfm_y`:`bool`=`False`, `kwargs`) :: [`Dataset`](https://pytorch.org/docs/stable/data.html#torch.utils.data.Dataset)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList, title_level=3, doc_string=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The basic dataset in fastai. Inputs are in `x`, targets in `y`. Optionally apply `tfms` to `x` and also `y` if `tfm_y` is `True`. "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> from_lists
(`path`:`PathOrStr`, `inputs`, `labels`) → `LabelList`\n",
"\n",
"Create a [`LabelList`](/data_block.html#LabelList) in `path` with `inputs` and `labels`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.from_lists)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> ItemLists
(`path`:`PathOrStr`, `train`:[`ItemList`](/data_block.html#ItemList), `valid`:[`ItemList`](/data_block.html#ItemList), `test`:[`ItemList`](/data_block.html#ItemList)=`None`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemLists, doc_string=False, title_level=3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Data in `path` split between several streams of inputs, [`train`](/train.html#train), `valid` and maybe `test`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_from_lists
(`train_labels`:`Iterator`, `valid_labels`:`Iterator`, `label_cls`:`Callable`=`None`, `kwargs`) → `LabelList`\n",
"\n",
"Use the labels in `train_labels` and `valid_labels` to label the data. `label_cls` will overwrite the default. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemLists.label_from_lists)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> LabelLists
(`path`:`PathOrStr`, `train`:[`ItemList`](/data_block.html#ItemList), `valid`:[`ItemList`](/data_block.html#ItemList), `test`:[`ItemList`](/data_block.html#ItemList)=`None`) :: [`ItemLists`](/data_block.html#ItemLists)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists, title_level=3, doc_string=False)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Helper functions"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get_files
(`c`:`PathOrStr`, `extensions`:`StrList`=`None`, `recurse`:`bool`=`False`) → `FilePathList`\n",
"\n",
"Return list of files in `c` that have a suffix in `extensions`. `recurse` determines if we search subfolders. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(get_files)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Undocumented Methods - Methods moved below this line will intentionally be hidden"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get
(`i`) → `Any`"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.get)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> new
(`items`, `classes`=`None`, `kwargs`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryList.new)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> label_cls
(`labels`, `label_cls`:`Callable`=`None`, `sep`:`str`=`None`, `kwargs`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.label_cls)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get_processors
()"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.get_processors)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> from_lists
(`path`:`PathOrStr`, `inputs`, `labels`) → `LabelList`\n",
"\n",
"Create a [`LabelList`](/data_block.html#LabelList) in `path` with `inputs` and `labels`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.from_lists)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> set_item
(`item`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.set_item)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> new
(`x`, `y`, `kwargs`) → `LabelList`"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.new)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get
(`i`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryList.get)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> predict
(`res`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.predict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> new
(`items`:`Iterator`, `create_func`:`Callable`=`None`, `processor`:[`PreProcessor`](/data_block.html#PreProcessor)=`None`, `kwargs`) → `ItemList`"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.new)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> clear_item
()"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.clear_item)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process_one
(`item`, `processor`=`None`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.process_one)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process
(`processor`=`None`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemList.process)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process
()"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelLists.process)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> predict
(`res`)\n",
"\n",
"Called at the end of `Learn.predict`; override for optional post-processing "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryList.predict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> transform
(`tfms`:`Optional`\\[`Tuple`\\[`Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\], `Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\]\\]\\]=`(None, None)`, `kwargs`)\n",
"\n",
"Set `tfms` to be applied to the train and validation set. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(ItemLists.transform)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process
(`xp`=`None`, `yp`=`None`)\n",
"\n",
"Launch the preprocessing on `xp` and `yp`. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.process)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> transform
(`tfms`:`Union`\\[`Callable`, `Collection`\\[`Callable`\\]\\], `tfm_y`:`bool`=`None`, `kwargs`)\n",
"\n",
"Set the `tfms` and `` tfm_y` value to be applied to the inputs and targets. "
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(LabelList.transform)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## New Methods - Please document or move to the undocumented section"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process_one
(`item`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(MultiCategoryProcessor.process_one)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get
(`i`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(FloatList.get)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process_one
(`item`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryProcessor.process_one)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> create_classes
(`classes`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryProcessor.create_classes)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> process
(`ds`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryProcessor.process)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> get
(`i`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(MultiCategoryList.get)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> new
(`items`, `kwargs`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(FloatList.new)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> generate_classes
(`items`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(MultiCategoryProcessor.generate_classes)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"hide_input": true
},
"outputs": [
{
"data": {
"text/markdown": [
"\n",
"\n",
"> generate_classes
(`items`)"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show_doc(CategoryProcessor.generate_classes)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
}
],
"metadata": {
"jekyll": {
"keywords": "fastai",
"summary": "The data block API",
"title": "data_block"
},
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}