This page contains examples and tutorials on how to visualize the 10000+ state-of-the-art NLP models in just 1 line of
code in streamlit
.
It includes simple 1-liners
you can sprinkle into your Streamlit app to for features like Dependency Trees, Named
Entities (NER), text classification results, semantic simmilarity,
embedding visualizations via ELMO, BERT, ALBERT, XLNET and much more . Additionally, improvements for T5 and various
resolvers have been added.
This is the ultimate NLP research tool. You can visualize and compare the results of hundreds of context aware deep
learning embeddings and compare them with classical vanilla embeddings like Glove
and can see with your own eyes how context is encoded by transformer models like BERT
or XLNET
and many more !
Besides that, you can also compare the results of the 200+ NER models John Snow Labs provides and see how peformances
changes with varrying ebeddings, like Contextual, Static and Domain Specific Embeddings.
Impatient and want some action?
Just run this Streamlit app, you can use it to generate python code for each Streamlit building block
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/01_dashboard.py
Quick Starter cheat sheet - All you need to know in 1 picture for NLP + Streamlit
For NLP models to load, see the NLP namespace or the John Snow Labs Modelshub or go straight to the source.
Examples
Just try out any of these. You can use the first example to generate python-code snippets which you can recycle as building blocks in your streamlit apps!x
Example: 01_dashboard
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/01_dashboard.py
Example: 02_NER
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/02_NER.py
Example: 03_text_similarity_matrix
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/03_text_similarity_matrix.py
Example: 04_dependency_tree
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/04_dependency_tree.py
Example: 05_classifiers
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/05_classifiers.py
Example: 06_token_features
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/06_token_features.py
Example: 07_token_embedding_dimension_reduction
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/07_token_embedding_manifolds.py
Example: 08_token_embedding_dimension_reduction
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/08_sentence_embedding_manifolds.py
Example: 09_entity_embedding_dimension_reduction
streamlit run https://raw.githubusercontent.com/JohnSnowLabs/nlu/master/examples/streamlit/09_entity_embedding_manifolds.py
How to use the nlp module?
All you need to know about the nlp module is that there is the nlp.load()
method
which returns a NLUPipeline
object
which has a .predict()
that works on
most common data types in the pydata stack like Pandas dataframes
.
Ontop of that, there are various visualization methods a NLUPipeline provides easily integrate in Streamlit as re-usable
components. viz() method
Overview of NLP + Streamlit buildingblocks
Method | Description |
---|---|
nlp.load('<Model>').predict(data) |
Load any of the 1000+ models by providing the model name any predict on most Pythontic data strucutres like Pandas, strings, arrays of strings and more |
nlp.load('<Model>').viz_streamlit(data) |
Display full NLP exploration dashboard, that showcases every feature avaiable with dropdown selectors for 1000+ models |
nlp.load('<Model>').viz_streamlit_similarity([string1, string2]) |
Display similarity matrix and scalar similarity for every word embedding loaded and 2 strings. |
nlp.load('<Model>').viz_streamlit_ner(data) |
Visualize predicted NER tags from Named Entity Recognizer model |
nlp.load('<Model>').viz_streamlit_dep_tree(data) |
Visualize Dependency Tree together with Part of Speech labels |
nlp.load('<Model>').viz_streamlit_classes(data) |
Display all extracted class features and confidences for every classifier loaded in pipeline |
nlp.load('<Model>').viz_streamlit_token(data) |
Display all detected token features and informations in Streamlit |
nlp.load('<Model>').viz(data, write_to_streamlit=True) |
Display the raw visualization without any UI elements. See viz docs for more info. By default all aplicable nlp model references will be shown. |
nlp.enable_streamlit_caching() |
Enable caching the nlp.load() call. Once enabled, the nlp.load() method will automatically cached. ** |
This is recommended** to run first and for large peformance gans |
Detailed visualizer information and API docs
function pipe.viz_streamlit
Display a highly configurable UI that showcases almost every feature available for Streamlit visualization with model
selection dropdowns in your applications.
Ths includes :
Similarity Matrix
&Scalars
&Embedding Information
for any of the 100+ Word Embedding ModelsNER visualizations
for any of the 200+ Named entity recognizersLabled
&Unlabled Dependency Trees visualizations
withPart of Speech Tags
for any of the 100+ Part of Speech ModelsToken informations
predicted by any of the 1000+ modelsClassification results
predicted by any of the 100+ models classification modelsPipeline Configuration
&Model Information
&Link to John Snow Labs Modelshub
for all loaded pipelinesAuto generate Python code
that can be copy pasted to re-create the individual Streamlit visualization blocks. NlLU takes the first model specified asnlp.load()
for the first visualization run.
Once the Streamlit app is running, additional models can easily be added via the UI.
It is recommended to run this first, since you can generate Python code snippetsto recreate individual Streamlit visualization blocks
nlp.load('ner').viz_streamlit(['I love NLP and Streamlit!', 'I hate buggy software'])
function parameters pipe.viz_streamlit
Argument | Type | Default | Description |
---|---|---|---|
text |
Union [str, List[str], pd.DataFrame, pd.Series] |
'NLP and Streamlit go together like peanutbutter and jelly' |
Default text for the Classification , Named Entitiy Recognizer , Token Information and Dependency Tree visualizations |
similarity_texts |
Union[List[str],Tuple[str,str]] |
('Donald Trump Likes to part', 'Angela Merkel likes to party') |
Default texts for the Text similarity visualization. Should contain exactly 2 strings which will be compared token embedding wise . For each embedding active, a token wise similarity matrix and a similarity scalar |
model_selection |
List[str] |
[] |
List of nlp references to display in the model selector, see the NLP namespace or the John Snow Labs Modelshub or go straight to the source for more info |
title |
str |
'NLP ❤️ Streamlit - Prototype your NLP startup in 0 lines of code🚀' |
Title of the Streamlit app |
sub_title |
str |
'Play with over 1000+ scalable enterprise NLP models' |
Sub title of the Streamlit app |
visualizers |
List[str] |
( "dependency_tree", "ner", "similarity", "token_information", 'classification') |
Define which visualizations should be displayed. By default all visualizations are displayed. |
show_models_info |
bool |
True |
Show information for every model loaded in the bottom of the Streamlit app. |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click |
show_viz_selection |
bool |
False |
Show a selector in the sidebar which lets you configure which visualizations are displayed. |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additonal information about ISO codes and the NLP namespace structure. |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
show_code_snippets |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
num_similarity_cols |
int |
2 |
How many columns should for the layout in Streamlit when rendering the similarity matrixes. |
function pipe.viz_streamlit_classes
Visualize the predicted classes and their confidences and additional metadata to streamlit. Aplicable with any of the 100+ classifiers
nlp.load('sentiment').viz_streamlit_classes(
['I love NLP and Streamlit!', 'I love buggy software', 'Sign up now get a chance to win 1000$ !',
'I am afraid of Snakes', 'Unicorns have been sighted on Mars!', 'Where is the next bus stop?'])
function parameters pipe.viz_streamlit_classes
Argument | Type | Default | Description |
---|---|---|---|
text |
Union[str,list,pd.DataFrame, pd.Series, pyspark.sql.DataFrame ] |
'I love NLU and Streamlit and sunny days!' |
Text to predict classes for. Will predict on each input of the iteratable or dataframe if type is not str. |
output_level |
Optional[str] |
document |
Outputlevel of NLP pipeline, see pipe.predict() docsmore info |
include_text_col |
bool |
True |
Whether to include a e text column in the output table or just the prediction data |
title |
Optional[str] |
Text Classification |
Title of the Streamlit building block that will be visualized to screen |
metadata |
bool |
False |
whether to output addition metadata or not, see pipe.predict(meta=true) docs for more info |
positions |
bool |
False |
whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additonal information about ISO codes and the NLP namespace structure. |
function pipe.viz_streamlit_ner
Visualize the predicted classes and their confidences and additional metadata to Streamlit.
Aplicable with any of the 250+ NER models.
You can filter which NER tags to highlight via the dropdown in the main window.
Basic usage
nlp.load('ner').viz_streamlit_ner('Donald Trump from America and Angela Merkel from Germany dont share many views')
Example for coloring
# Color all entities of class GPE black
nlp.load('ner').viz_streamlit_ner('Donald Trump from America and Angela Merkel from Germany dont share many views',
colors={'PERSON': '#6e992e', 'GPE': '#000000'})
function parameters pipe.viz_streamlit_ner
Argument | Type | Default | Description |
---|---|---|---|
text |
str |
'Donald Trump from America and Anegela Merkel from Germany do not share many views' |
Text to predict classes for. |
ner_tags |
Optional[List[str]] |
None |
Tags to display. By default all tags will be displayed |
show_label_select |
bool |
True |
Whether to include the label selector |
show_table |
bool |
True |
Whether show to predicted pandas table or not |
title |
Optional[str] |
'Named Entities' |
Title of the Streamlit building block that will be visualized to screen |
sub_title |
Optional[str] |
'"Recognize various Named Entities (NER) in text entered and filter them. You can select from over 100 languages in the dropdown. On the left side.",' |
Sub-title of the Streamlit building block that will be visualized to screen |
colors |
Dict[str,str] |
{} |
Dict with KEY=ENTITY_LABEL and VALUE=COLOR_AS_HEX_CODE ,which will change color of highlighted entities.See custom color labels docs for more info. |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models available in 1 click |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
show_text_input |
bool |
True |
Show text input field to input text in |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additional information about ISO codes and the NLP namespace structure. |
function pipe.viz_streamlit_dep_tree
Visualize a typed dependency tree, the relations between tokens and part of speech tags predicted. Aplicable with any of the 100+ Part of Speech(POS) models and dep tree model
nlp.load('dep.typed').viz_streamlit_dep_tree(
'POS tags define a grammatical label for each token and the Dependency Tree classifies Relations between the tokens')
function parameters pipe.viz_streamlit_dep_tree
Argument | Type | Default | Description |
---|---|---|---|
text |
str |
'Billy likes to swim' |
Text to predict classes for. |
title |
Optional[str] |
'Dependency Parse Tree & Part-of-speech tags' |
Title of the Streamlit building block that will be visualized to screen |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additonal information about ISO codes and the NLP namespace structure. |
function pipe.viz_streamlit_token
Visualize predicted token and text features for every model loaded. You can use this with any of the 1000+ models and select them from the left dropdown.
nlp.load('stemm pos spell').viz_streamlit_token('I liek pentut buttr and jelly !')
function parameters pipe.viz_streamlit_token
Argument | Type | Default | Description |
---|---|---|---|
text |
str |
'NLU and Streamlit are great!' |
Text to predict token information for. |
title |
Optional[str] |
'Named Entities' |
Title of the Streamlit building block that will be visualized to screen |
show_feature_select |
bool |
True |
Whether to include the token feature selector |
features |
Optional[List[str]] |
None |
Features to to display. By default all Features will be displayed |
metadata |
bool |
False |
Whether to output addition metadata or not, see pipe.predict(meta=true) docs for more info |
output_level |
Optional[str] |
'token' |
Outputlevel of NLP pipeline, see pipe.predict() docsmore info |
positions |
bool |
False |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additonal information about ISO codes and the NLP namespace structure. |
function pipe.viz_streamlit_similarity
- Displays a
similarity matrix
, wherex-axis
is every token in the first text andy-axis
is every token in the second text. - Index
i,j
in the matrix describes the similarity oftoken-i
totoken-j
based on the loaded embeddings and distance metrics, based on Sklearns Pariwise Metrics. . See this article for more elaboration on similarities - Displays a dropdown selectors from which various similarity metrics and over 100 embeddings can be selected.
-There will be one similarity matrix per
metric
andembedding
pair selected.num_plots = num_metric*num_embeddings
Also displays embedding vector information. Applicable with any of the 100+ Word Embedding models
nlp.load('bert').viz_streamlit_word_similarity(
['I love love loooove NLP! <3', 'I also love love looove Streamlit! <3'])
function parameters pipe.viz_streamlit_similarity
Argument | Type | Default | Description |
---|---|---|---|
texts |
str |
'Donald Trump from America and Anegela Merkel from Germany do not share many views.' |
Text to predict token information for. |
title |
Optional[str] |
'Named Entities' |
Title of the Streamlit building block that will be visualized to screen |
similarity_matrix |
bool |
None |
Whether to display similarity matrix or not |
show_algo_select |
bool |
True |
Whether to show dist algo select or not |
show_table |
bool |
True |
Whether show to predicted pandas table or not |
threshold |
float |
0.5 |
Threshold for displaying result red on screen |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn |
generate_code_sample |
bool |
False |
Display Python code snippets above visualizations that can be used to re-create the visualization |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
write_raw_pandas |
bool |
False |
Write the raw pandas similarity df to streamlit |
display_embed_information |
bool |
True |
Show additional embedding information like dimension , nlu_reference , spark_nlp_reference , sotrage_reference , modelhub link and more. |
dist_metrics |
List[str] |
['cosine'] |
Which distance metrics to apply. If multiple are selected, there will be multiple plots for each embedding and metric. num_plots = num_metric*num_embeddings . Can use multiple at the same time, any of of cityblock ,cosine ,euclidean ,l2 ,l1 ,manhattan ,nan_euclidean . Provided via Sklearn metrics.pairwise package |
num_cols |
int |
2 |
How many columns should for the layout in streamlit when rendering the similarity matrixes. |
display_scalar_similarities |
bool |
False |
Display scalar similarities in an additional field. |
display_similarity_summary |
bool |
False |
Display summary of all similarities for all embeddings and metrics. |
show_logo |
bool |
True |
Show logo |
display_infos |
bool |
False |
Display additional information about ISO codes and the NLP namespace structure. |
Embedding visualization via Manifold and Matrix Decomposition algorithms
function pipe.viz_streamlit_word_embed_manifold
Visualize Word Embeddings in 1-D
, 2-D
, or 3-D
by Reducing Dimensionality
via 11 Supported methods
from Manifold Algorithms
and Matrix Decomposition Algorithms
.
Additionally, you can color the lower dimensional points with a label that has been previously assigned to the text by
specifying a list of nlp references in the additional_classifiers_for_coloring
parameter.
- Reduces Dimensionality of high dimensional Word Embeddings to
1-D
,2-D
, or3-D
and plot the resulting data in an interactivePlotly
plot - Applicable with any of the 100+ Word Embedding models
- Color points by classifying with any of the 100+ Parts of Speech Classifiers or Document Classifiers
- Gemerates
NUM-DIMENSIONS
*NUM-EMBEDDINGS
*NUM-DIMENSION-REDUCTION-ALGOS
plots
nlp.load('bert', verbose=True).viz_streamlit_word_embed_manifold(default_texts=['I love NLU <3', 'I love streamlit <3'],
default_algos_to_apply=['TSNE'], MAX_DISPLAY_NUM=5)
function parameters pipe.viz_streamlit_word_embed_manifold
Argument | Type | Default | Description | |
---|---|---|---|---|
default_texts |
List[str] |
(“Donald Trump likes to party!”, “Angela Merkel likes to party!”, ‘Peter HATES TO PARTTY!!!! :(‘) | List of strings to apply classifiers, embeddings, and manifolds to. | |
text |
Optional[str] |
'Billy likes to swim' |
Text to predict classes for. | |
sub_title |
Optional[str] |
“Apply any of the 11 Manifold or Matrix Decomposition algorithms to reduce the dimensionality of Word Embeddings to 1-D , 2-D and 3-D “ |
Sub title of the Streamlit app | |
default_algos_to_apply |
List[str] |
["TSNE", "PCA"] |
A list Manifold and Matrix Decomposition Algorithms to apply. Can be either 'TSNE' ,'ISOMAP' ,'LLE' ,'Spectral Embedding' , 'MDS' ,'PCA' ,'SVD aka LSA' ,'DictionaryLearning' ,'FactorAnalysis' ,'FastICA' or 'KernelPCA' , |
|
target_dimensions |
List[int] |
(1,2,3) |
Defines the target dimension embeddings will be reduced to | |
show_algo_select |
bool |
True |
Show selector for Manifold and Matrix Decomposition Algorithms | |
show_embed_select |
bool |
True |
Show selector for Embedding Selection | |
show_color_select |
bool |
True |
Show selector for coloring plots | |
MAX_DISPLAY_NUM |
int |
100 |
Cap maximum number of Tokens displayed | |
display_embed_information |
bool |
True |
Show additional embedding information like dimension , nlu_reference , spark_nlp_reference , sotrage_reference , modelhub link and more. |
|
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. | |
num_cols |
int |
2 |
How many columns should for the layout in streamlit when rendering the similarity matrixes. | |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn | |
additional_classifiers_for_coloring |
List[str] |
['pos', 'sentiment.imdb'] |
List of additional NLP references to load for generating hue colors | |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models available in 1 click | |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
|
show_logo |
bool |
True |
Show logo | |
display_infos |
bool |
False |
Display additional information about ISO codes and the NLP namespace structure. | |
n_jobs |
Optional[int] |
3 |
False |
How many cores to use for paralellzing when using Sklearn Dimension Reduction algorithms. |
Larger Example showcasing more dimension reduction techniques on a larger corpus:
function pipe.viz_streamlit_sentence_embed_manifold
Visualize Sentence Embeddings in 1-D
, 2-D
, or 3-D
by Reducing Dimensionality
via 12 Supported methods
from Manifold Algorithms
and Matrix Decomposition Algorithms
.
Additionally, you can color the lower dimensional points with a label that has been previously assigned to the text by
specifying a list of nlp references in the additional_classifiers_for_coloring
parameter.
You can also select additional classifiers via the GUI.
- Reduces Dimensionality of high dimensional Sentence Embeddings to
1-D
,2-D
, or3-D
and plot the resulting data in an interactivePlotly
plot - Applicable with any of the 100+ Sentence Embedding models
- Color points by classifying with any of the 100+ Document Classifiers
- Gemerates
NUM-DIMENSIONS
*NUM-EMBEDDINGS
*NUM-DIMENSION-REDUCTION-ALGOS
plots
nlp.load('embed_sentence.bert').viz_streamlit_sentence_embed_manifold(['text1', 'text2tdo'])
function parameters pipe.viz_streamlit_sentence_embed_manifold
Argument | Type | Default | Description | |
---|---|---|---|---|
default_texts |
List[str] |
(“Donald Trump likes to party!”, “Angela Merkel likes to party!”, ‘Peter HATES TO PARTTY!!!! :(‘) | List of strings to apply classifiers, embeddings, and manifolds to. | |
text |
Optional[str] |
'Billy likes to swim' |
Text to predict classes for. | |
sub_title |
Optional[str] |
“Apply any of the 11 Manifold or Matrix Decomposition algorithms to reduce the dimensionality of Sentence Embeddings to 1-D , 2-D and 3-D “ |
Sub title of the Streamlit app | |
default_algos_to_apply |
List[str] |
["TSNE", "PCA"] |
A list Manifold and Matrix Decomposition Algorithms to apply. Can be either 'TSNE' ,'ISOMAP' ,'LLE' ,'Spectral Embedding' , 'MDS' ,'PCA' ,'SVD aka LSA' ,'DictionaryLearning' ,'FactorAnalysis' ,'FastICA' or 'KernelPCA' , |
|
target_dimensions |
List[int] |
(1,2,3) |
Defines the target dimension embeddings will be reduced to | |
show_algo_select |
bool |
True |
Show selector for Manifold and Matrix Decomposition Algorithms | |
show_embed_select |
bool |
True |
Show selector for Embedding Selection | |
show_color_select |
bool |
True |
Show selector for coloring plots | |
display_embed_information |
bool |
True |
Show additional embedding information like dimension , nlu_reference , spark_nlp_reference , sotrage_reference , modelhub link and more. |
|
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. | |
num_cols |
int |
2 |
How many columns should for the layout in streamlit when rendering the similarity matrixes. | |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn | |
additional_classifiers_for_coloring |
List[str] |
['sentiment.imdb'] |
List of additional NLP references to load for generting hue colors | |
show_model_select |
bool |
True |
Show a model selection dropdowns that makes any of the 1000+ models avaiable in 1 click | |
model_select_position |
str |
'side' |
Whether to output the positions of predictions or not, see pipe.predict(positions=true ) for more info |
|
show_logo |
bool |
True |
Show logo | |
display_infos |
bool |
False |
Display additional information about ISO codes and the NLP namespace structure. | |
n_jobs |
Optional[int] |
3 |
How many cores to use for paralleling when using Sklearn Dimension Reduction algorithms. |
Streamlit Entity Manifold visualization
function pipe.viz_streamlit_entity_embed_manifold
Visualize recognized entities by NER models via their Entity Embeddings in 1-D
, 2-D
, or 3-D
by Reducing Dimensionality
via 10+ Supported methods
from Manifold Algorithms
and Matrix Decomposition Algorithms
.
You can pick additional NER models and compare them via the GUI dropdown on the left.
- Reduces Dimensionality of high dimensional Entity Embeddings to
1-D
,2-D
, or3-D
and plot the resulting data in an interactivePlotly
plot - Applicable with any of the 330+ Named Entity Recognizer models
- Generates
NUM-DIMENSIONS
*NUM-NER-MODELS
*NUM-DIMENSION-REDUCTION-ALGOS
plots
nlp.load('ner').viz_streamlit_sentence_embed_manifold(['Hello From John Snow Labs', 'Peter loves to visit New York'])
function parameters pipe.viz_streamlit_sentence_embed_manifold
Argument | Type | Default | Description | |
---|---|---|---|---|
default_texts |
List[str] |
“Donald Trump likes to visit New York”, “Angela Merkel likes to visit Berlin!”, ‘Peter hates visiting Paris’) | List of strings to apply classifiers, embeddings, and manifolds to. | |
title |
str |
'NLU ❤️ Streamlit - Prototype your NLP startup in 0 lines of code🚀' |
Title of the Streamlit app | |
sub_title |
Optional[str] |
“Apply any of the 10+ Manifold or Matrix Decomposition algorithms to reduce the dimensionality of Entity Embeddings to 1-D , 2-D and 3-D “ |
Sub title of the Streamlit app | |
default_algos_to_apply |
List[str] |
["TSNE", "PCA"] |
A list Manifold and Matrix Decomposition Algorithms to apply. Can be either 'TSNE' ,'ISOMAP' ,'LLE' ,'Spectral Embedding' , 'MDS' ,'PCA' ,'SVD aka LSA' ,'DictionaryLearning' ,'FactorAnalysis' ,'FastICA' or 'KernelPCA' , |
|
target_dimensions |
List[int] |
(1,2,3) |
Defines the target dimension embeddings will be reduced to | |
show_algo_select |
bool |
True |
Show selector for Manifold and Matrix Decomposition Algorithms | |
set_wide_layout_CSS |
bool |
True |
Whether to inject custom CSS or not. | |
num_cols |
int |
2 |
How many columns should for the layout in streamlit when rendering the similarity matrices. | |
key |
str |
"NLU_streamlit" |
Key for the Streamlit elements drawn | |
show_logo |
bool |
True |
Show logo | |
display_infos |
bool |
False |
Display additional information about ISO codes and the NLP namespace structure. | |
n_jobs |
Optional[int] |
3 |
False |
How many cores to use for paralellzing when using Sklearn Dimension Reduction algorithms. |