GithubHelp home page GithubHelp logo

[BUG] Strange import behaviour? about darts HOT 2 OPEN

elbal avatar elbal commented on June 3, 2024
[BUG] Strange import behaviour?

from darts.

Comments (2)

madtoinou avatar madtoinou commented on June 3, 2024

Hi @elbal,

Thank you for reporting this. I think that the modules need to be linked to the top __init__.py in order to get the expected behavior when using import darts. Just need to make sure that it does not cause other issues.

However, it is expected to be able to import the models from different levels of the library: darts.models for the sake of simplicity (thanks to the logic in the corresponding __init__.py) as visible in the documentation code example but also their "original" file, for example; darts/models/forecasting/baselines.py for NaiveMean (as displayed in the name of the class in the documentation). Not sure to understand why this could be a problem.

from darts.

elbal avatar elbal commented on June 3, 2024

@madtoinou Thank you for your reply. I missed the example in the documentation as I went straight for the API.
I think it would make sense just to link the main modules in the main __init__.py.

A slightly different issue (?) arises for the submodules. For example:

import pandas as pd
import darts.models
import matplotlib.pyplot as plt

df = pd.DataFrame({"demand": [
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
    14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
    ]})
ts = darts.TimeSeries.from_dataframe(df)

darts.models.forecasting.baselines.NaiveMean(ts)
darts.utils.statistics.plot_acf(ts)

plt.show()

Works, but Pycharm does not recognize the reference baselines and throws a waring.
The reference forecasting, instead, is recognized even if it is not direcly linked in the darts.models __init__.py:
https://github.com/unit8co/darts/blob/master/darts/models/__init__.py

I suspect the reason is that in the darts.models __init__.py there are references like darts.models.forecasting.exponential_smoothing that imply darts.models.forecasting but not darts.models.forecasting.baselines.

Is it something that should be fixed or the user is suppoosed to call the classes directly form darts.models?

from darts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.