Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| from datetime import datetime | |
| import numpy as np | |
| import re | |
| # To datetime conversion | |
| def to_datetime(x: str) -> datetime: | |
| """ | |
| Converts a string to a datetime object | |
| An example of the string is 2010-02-02 17:24:55 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| # Defining the function for distance calculation | |
| def distance_calculation(df: pd.DataFrame) -> pd.DataFrame: | |
| """ | |
| Calculates the distance between two points on the earth's surface. | |
| The distance is in meters | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| from sklearn.preprocessing import OneHotEncoder | |
| import numpy as np | |
| # Defining the function for dummy creation | |
| def create_dummy(df: pd.DataFrame, dummy_var_list: list) -> Tuple: | |
| """ | |
| Creates dummy variables for the variables in dummy_var_list | |
| Returns a tuple of the following |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Deep learning | |
| import tensorflow as tf | |
| import keras | |
| # Memory tracking | |
| from memory_profiler import profile | |
| @profile | |
| def create_model( | |
| input_size: int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Importing the feature engineering pipeline | |
| from utils import ft_engineering_pipeline | |
| # Data wrangling | |
| import pandas as pd | |
| # Memory tracking | |
| from memory_profiler import profile | |
| # Command line arguments |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import numpy as np | |
| import keras | |
| # Defining the class for the batches creation | |
| class DataGenerator(keras.utils.Sequence): | |
| def __init__( | |
| self, | |
| csv_generator: pd.io.parsers.readers.TextFileReader, | |
| n_batches: int, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Data wrangling | |
| import pandas as pd | |
| # Deep learning | |
| import tensorflow as tf | |
| import keras | |
| # Import feature engineering functions | |
| from utils import create_date_vars, distance_calculation, custom_transform |
OlderNewer