<jupyter_start><jupyter_text>Get label<jupyter_code>malaya.emotion.label<jupyter_output><empty_output><jupyter_text>All models follow same method as sklearn interface, `predict` to get batch of labels, `predict_proba` to get batch of probabilities.  Load multinomial modelAll model interface will follow sklearn interface started v3.4,```pythonmodel.predict(List[str])model.predict_proba(List[str])```<jupyter_code>model = malaya.emotion.multinomial()
model.predict([anger_text])
model.predict(
    [anger_text, fear_text, happy_text, love_text, sadness_text, surprise_text]
)
model.predict_proba(
    [anger_text, fear_text, happy_text, love_text, sadness_text, surprise_text]
)<jupyter_output><empty_output><jupyter_text>List available Transformer models<jupyter_code>malaya.emotion.available_transformer()<jupyter_output><empty_output><jupyter_text>Make sure you can check accuracy chart from here first before select a model, https://malaya.readthedocs.io/en/latest/Accuracy.htmlemotion-analysis**You might want to use Tiny-Albert, a very small size, 22.4MB, but the accuracy is still on the top notch.**  Load Albert modelAll model interface will follow sklearn interface started v3.4,```pythonmodel.predict(List[str])model.predict_proba(List[str])```<jupyter_code>model = malaya.emotion.transformer(model = 'albert')<jupyter_output>WARNING:tensorflow:From /Users/huseinzolkepli/Documents/Malaya/malaya/function/__init__.py:54: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

WARNING:tensorflow:From /Users/huseinzolkepli/Documents/Malaya/malaya/function/__init__.py:55: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

WARNING:tensorflow:From /usr/local/lib/python3.7/site-packages/albert/tokenization.py:240: The name tf.logging.info is deprecated. Please use tf.compat.v1.logging.info instead.

INFO:tensorflow:loading sentence piece model
WARNING:tensorflow:From /Users/huseinzolkepli/Documents/Malaya/malaya/function/__init__.py:49: The name tf.InteractiveSession is deprecated. Please use tf.compat.v1.InteractiveSession instead.<jupyter_text>Predict batch of strings<jupyter_code>model.predict_proba(
    [anger_text, fear_text, happy_text, love_text, sadness_text, surprise_text]
)<jupyter_output><empty_output><jupyter_text>Open emotion visualization dashboardDefault when you call `predict_words` it will open a browser with visualization dashboard, you can disable by `visualization=False`.<jupyter_code>model.predict_words(sadness_text)
from IPython.core.display import Image, display

display(Image('emotion-dashboard.png', width=800))<jupyter_output><empty_output><jupyter_text>Stacking modelsMore information, you can read at [https://malaya.readthedocs.io/en/latest/Stack.html](https://malaya.readthedocs.io/en/latest/Stack.html)<jupyter_code>multinomial = malaya.emotion.multinomial()
malaya.stack.predict_stack([multinomial, model], [anger_text])
malaya.stack.predict_stack([multinomial, model], [anger_text, sadness_text])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10704874835309618, 'fraction_numerical': 0.007905138339920948, 'mean_word_length': 7.932352941176471, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '406548', 'license': 'MIT', 'n_tokens_mistral': 1025, 'n_tokens_neox': 978, 'n_words': 197, 'path': 'example/emotion/load-emotion.ipynb', 'repo_name': 'DSA-CoE/malaya', 'size': '3036'}