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
# Using @property decorator | |
# Source - https://www.programiz.com/python-programming/property | |
class Celsius: | |
def __init__(self, temperature=0): | |
self.temperature = temperature | |
def to_fahrenheit(self): | |
return (self.temperature * 1.8) + 32 | |
@property |
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
def windowed_dataset(series, window_size, batch_size, shuffle_buffer): | |
"""Function for creating a windowed dataset for sequence training""" | |
dataset = tf.data.Dataset.from_tensor_slices(series) | |
dataset = dataset.window(window_size + 1, shift=1, drop_remainder=True) | |
dataset = dataset.flat_map(lambda window: window.batch(window_size + 1)) | |
dataset = dataset.shuffle(shuffle_buffer).map(lambda window: (window[:-1], window[-1])) | |
dataset = dataset.batch(batch_size).prefetch(1) | |
return dataset |
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 | |
for i in list_vals: | |
print('Anshaj') |
NewerOlder