Skip to content
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

feature/make_zn_scores_efficient #352

Merged
merged 79 commits into from
Jun 7, 2022
Merged

Conversation

Ksteeds
Copy link
Contributor

@Ksteeds Ksteeds commented May 16, 2022

def func_executor(df: pd.DataFrame, neutral: str, n: int):
"""
Function used to clean up the repetitive code in the below methods. Will produce the
evolving neutral level.

:param <pd.DataFrame> df:
:param <str> neutral:
:param <int> n: number of dates the neutral level is computed over.
"""

if neutral == "mean":
    return np.array([df.iloc[0:(i + 1), :].stack().mean() for i in range(n)])
else:
    return np.array([df.iloc[0:(i + 1), :].stack().median() for i in range(n)])

@Ksteeds Ksteeds requested a review from rsueppel May 16, 2022 13:29
@Ksteeds Ksteeds self-assigned this May 16, 2022
@Ksteeds Ksteeds changed the title Algorithmic design. feature/make_zn_scores_efficient May 16, 2022
@Ksteeds
Copy link
Contributor Author

Ksteeds commented May 16, 2022

Tied to the issue #342.

@Ksteeds
Copy link
Contributor Author

Ksteeds commented May 17, 2022

Time taken for functional executor, median: 13.972623825073242
Overall time taken for make_zn_scores(): 24.274497985839844

@Ksteeds
Copy link
Contributor Author

Ksteeds commented May 17, 2022

Time taken for functional executor, mean: 9.492730140686035
Overall time taken for make_zn_scores(): 19.86984610557556

Definitely scope to improve the above computational speed of a rolling mean.

@Ksteeds
Copy link
Contributor Author

Ksteeds commented May 17, 2022

Following upgrades median algorithm takes: Time taken: 11.616146087646484.
Following upgrades mean algorithm takes: Time taken: 12.103456974029541

@Ksteeds
Copy link
Contributor Author

Ksteeds commented May 18, 2022

def iis_std_panel(dfx: pd.DataFrame, min_obs: int, sequential: bool = True,
iis: bool = True):
"""
Function designed to compute the standard deviations but accounts for in-sampling
period. The in-sampling standard deviation will be a fixed value.
"""
Aim to improve the performance speed of this subroutine.

@Ksteeds Ksteeds merged commit d4661d6 into develop Jun 7, 2022
@lsimonsen lsimonsen deleted the feature/make_zn_scores_efficient branch September 29, 2022 19:04
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.

make_zn_score: sequential estimation needs to increase speed with added parameter
3 participants