question

Upvotes
Accepted
1 1 1 3

ModuleNotFoundError: No module named 'LabelBuilders'

Article: Idiosyncratic risk ranking using eXplainable AI

https://github.com/Refinitiv-API-Samples/Article.RD.XAI.Python.Explaining.Idiosyncratic.Risk


-----------------------------------------------------------------------------------------------------------------

# Label Builder

class LabelBuilders:

def __init__(self, beta_window) -> None:

self.beta_window = beta_window

-----------------------------------------------------------------------------------------------------------------

# Feature Engineering

import pandas as pd

import numpy as np

import torch


from LabelBuilders import LabelBuilder

from functools import reduce

from utilities import drop_features, study_features

----------------------------------------------------------------------------------------------------------------

Error Message

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
Cell In[4], line 8
      6 from sklearn.preprocessing import MinMaxScaler, OneHotEncoder
      7 from tqdm import tqdm
----> 8 from LabelBuilders import LabelBuilder
      9 from functools import reduce
     10 from utilities import drop_features, study_features

ModuleNotFoundError: No module named 'LabelBuilders'


-----------------------------------------------------------------------------------------------------------------

How to solve it?


python#technologyerrormodule
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
83.1k 281 53 77

@thseol

I think the LabelBuilder is available on GitHub.

1691566942639.png


The FeatureEngineering.py uses this class: LabelBuilder.

1691567009761.png


The code in the question is different from GitHub. There is no LabelBuilders.



1691566942639.png (42.3 KiB)
1691567009761.png (47.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
26.4k 62 17 14

Hello @thseol

Thank you for contacting us. However, this Q&A forum is for Refinitiv APIs general usage questions only. Which Refinitiv APIs that you are using?

By the way, the "ModuleNotFoundError: No module named 'LabelBuilders'" indicates that the Python cannont find the LabelBuilders library in the environment. Did you install the library yet?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
1 1 1 3

Download the script from https://github.com/Refinitiv-API-Samples/Article.RD.XAI.Python.Explaining.Idiosyncratic.Risk

change the filename extension from .py to .ipynb

Running on jupyter notebook

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you for answering

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.