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

cross-platform file paths #2

Open
ghost opened this issue May 5, 2022 · 1 comment
Open

cross-platform file paths #2

ghost opened this issue May 5, 2022 · 1 comment

Comments

@ghost
Copy link

ghost commented May 5, 2022

Instead of this path parsing one-liner...

existing_files = [file.split('/')[2] for file in glob.glob(prices_folder + '*')]

I'm running on Windows and not Mac or linux. The filepath returns "" and not "/".

I solved this by using "from pathlib import Path" and replacing this one-liner with: 

existing_files = [Path(file).name for file in glob.glob(prices_folder + '*')]

I replaced about ~20 different file path instances relying on '/' split. Using pathlib .name and .path should solve all of these issues. 

    folder_name = subdirectory.split('/')[1][:-1]
    description = subdirectory.split('/')[2]

For these, I used "from pathlib import PurePath" like so: 

    folder_name = PurePath(subdirectory).parts[1][:-1]
    description = PurePath(subdirectory).parts[2]

Thought you might be interested in changing this, too.

Also, I've trained the model and now I'm testing. The "test" has been running for over 30+ and still running. I have a powerful computer with 32gb RAM. Is this normal?

@renatovotto
Copy link
Owner

Hi @peteawest,

Sorry for this and good point, and in fact I realised late I had neglected this to ensure portability. Happy to implement it on the master.

Regarding the long running time, the parts where the program takes long are:

  1. The downloading of the twitter posts on the original dates provided, if you are somehow ignoring the data originally uploaded
  2. The training of the random forest from scratch with all the parameters combinations given

If you weren't in any of the above processes, I suspect something is wrong (for me it took about 10 hours for each).
Any questions, let me know.

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

No branches or pull requests

1 participant