Skip to content

Forecast #3219

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 40 commits into from
Oct 24, 2020
Merged

Forecast #3219

merged 40 commits into from
Oct 24, 2020

Conversation

nandiya
Copy link
Contributor

@nandiya nandiya commented Oct 12, 2020

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@nandiya
Copy link
Contributor Author

nandiya commented Oct 12, 2020

@dhruvmanila please review my code

from statsmodels.tsa.statespace.sarimax import SARIMAX


def lin_reg_pred(train_dt, train_usr, train_mtch, test_dt, test_mtch):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints? Doctests? See CONTRIBUTING.md.

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 85c68050-0cfd-11eb-b943-5b98ff54aa42

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 16dd23f0-0cfe-11eb-b943-5b98ff54aa42

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 7e48c830-0d3c-11eb-9111-f326d0cb7f09

return prediction


def sarimax_predictor(train_user, train_match, test_match):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints?

return result[0]


def support_machine_regressor(x_train, x_test, train_user):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints?

return y_pred[0]


def interquartile_range_checker(train_user):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints?

return low_lim


def data_safety_checker(list_vote, actual_result):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arent the hints input and output that i described??
or did i do it wrongly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.python.org/3/library/typing.html is described in CONTRIBUTING.md. Or look at other Python files in this repo.



# data_input_df = pd.read_csv("ex_data.csv", header=None)
list_data = [[18231, 0.0, 1], [22621, 1.0, 2], [15675, 0.0, 3], [23583, 1.0, 4]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a more self-documenting variable name than list_data. What is this a list of? Are these stock quotes or swine flu patients or food orders? Help the reader understand what this data is so they can understand why all this analysis is worth doing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, please check it if the current one can be used or not

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 58799020-0d3d-11eb-9111-f326d0cb7f09

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: e46d8140-0d3d-11eb-9111-f326d0cb7f09

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 52649e50-0d51-11eb-9111-f326d0cb7f09

@TravisBuddy
Copy link

Travis tests have failed

Hey @nandiya,
Please read the following log in order to understand the failure reason.
It'll be awesome if you fix what's wrong and commit the changes.

TravisBuddy Request Identifier: 609ea0a0-0d52-11eb-9111-f326d0cb7f09

@nandiya
Copy link
Contributor Author

nandiya commented Oct 13, 2020

@cclauss i'm still confuse with the hints that u were mentioned, since in contributing.md only described normal input and output

@cclauss
Copy link
Member

cclauss commented Oct 24, 2020

From CONTRIBUTING.md:

The use of Python type hints is encouraged for function parameters and return values. Our automated testing will run mypy so run that locally before making your submission.

def sum_ab(a: int, b: int) -> int:
    return a + b

@nandiya
Copy link
Contributor Author

nandiya commented Oct 24, 2020

@cclauss done changing that
but please help me one thing, i think the web https://gitlab.com/pycqa/flake8 is down, so its unable to use flake resulting unpass pre commit.. please do something abt it.
Screen Shot 2020-10-24 at 16 53 24

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type hints on data_safety_checker() please.

from statsmodels.tsa.statespace.sarimax import SARIMAX


def lin_reg_pred(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def lin_reg_pred(
def linear regression_prediction(

Don't make the reader guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 35 to 36
prediction = abs(beta[0] + test_dt[0] * beta[1] + test_mtch[0] + beta[2])
return prediction
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
prediction = abs(beta[0] + test_dt[0] * beta[1] + test_mtch[0] + beta[2])
return prediction
return abs(beta[0] + test_dt[0] * beta[1] + test_mtch[0] + beta[2])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return result[0]


def support_machine_regressor(x_train: list, x_test: list, train_user: list) -> float:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def support_machine_regressor(x_train: list, x_test: list, train_user: list) -> float:
def support_vector_regressor(x_train: list, x_test: list, train_user: list) -> float:

Matches the docstring on the next line.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines 114 to 117
if safe > not_safe:
print("today's data is safe")
else:
print("today's data is not safe")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if safe > not_safe:
print("today's data is safe")
else:
print("today's data is not safe")
print("today's data is {'not ' if safe <= not_safe else ''}safe")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idk whether that code is working, but i got ur point to use inline if print

--done

@nandiya nandiya requested a review from cclauss October 24, 2020 14:04
Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your persistence!

@cclauss cclauss merged commit 12c6980 into TheAlgorithms:master Oct 24, 2020
stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
peRFectBeliever pushed a commit to peRFectBeliever/Python that referenced this pull request Apr 1, 2021
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
Panquesito7 pushed a commit to Panquesito7/Python that referenced this pull request May 13, 2021
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
shermanhui pushed a commit to shermanhui/Python that referenced this pull request Oct 22, 2021
* add forecasting code

* add statsmodel

* sort import

* sort import fix

* fixing black

* sort requirement

* optimize code

* try with limited data

* sort again

* sort fix

* sort fix

* delete warning and black

* add code for forecasting

* use black

* add more hints to describe

* add doctest

* finding whitespace

* fixing doctest

* delete

* revert back

* revert back

* revert back again

* revert back again

* revert back again

* try trimming whitespace

* try adding doctypeand etc

* fixing reviews

* deleting all the space

* fixing the build

* delete x

* add description for safety checker

* deleting subscription integer

* fix docthint

* make def to use function parameters and return values

* make def to use function parameters and return values

* type hints on data safety checker

* optimize code

* Update run.py

Co-authored-by: FVFYK3GEHV22 <[email protected]>
Co-authored-by: Christian Clauss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants