This file contains 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
from datetime import datetime, timedelta | |
from textwrap import dedent | |
from functor import my_function | |
# The DAG object; we'll need this to instantiate a DAG | |
from airflow import DAG | |
# Operators; we need this to operate! | |
from airflow.operators.bash import BashOperator |
This file contains 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
from pyspark.sql.functions import col | |
def groupby(df, columns): | |
sdf = df.to_spark() | |
_groups = sdf.select(*columns).distinct().collect() | |
_groups = [group.asDict() for group in _groups] | |
groups = [] | |
for group in _groups: | |
tmp = [] | |
for column in columns: |
This file contains 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
from tensorflow.keras import Model | |
import tensorflow as tf | |
import numpy as np | |
import pandas as pd | |
import random | |
class ReluDense(tf.Module): | |
def __init__(self, in_features, out_features, name=None): | |
super().__init__(name=name) | |
self.w = tf.Variable( |
This file contains 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
from tensorflow.keras import Model | |
import tensorflow as tf | |
import numpy as np | |
import pandas as pd | |
import random | |
class ReluDense(tf.Module): | |
def __init__(self, in_features, out_features, name=None): | |
super().__init__(name=name) | |
self.w = tf.Variable( |
This file contains 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
from tensorflow.keras import Model | |
import tensorflow as tf | |
import numpy as np | |
import pandas as pd | |
import random | |
class ReluDense(tf.Module): | |
def __init__(self, in_features, out_features, name=None): | |
super().__init__(name=name) | |
self.w = tf.Variable( |
This file contains 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 tensorflow as tf | |
import numpy as np | |
import pandas as pd | |
class ReluDense(tf.Module): | |
def __init__(self, in_features, out_features, name=None): | |
super().__init__(name=name) | |
self.w = tf.Variable( | |
tf.random.normal([out_features, out_features]), name='w' | |
) |
This file contains 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
pyramid_sum = lambda n: (2*(n**2) - (2*n - 1)) |
This file contains 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
from glob import glob | |
from json import load | |
def loc(nb): | |
cells = load(open(nb))["cells"] | |
return sum(len(c["source"]) for c in cells) | |
root_folder = "~" | |
summation = 0 | |
for File in glob(root_folder+"/**/*.ipynb", recursive=True): |
This file contains 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
python setup.py sdist bdist_wheel | |
python -m twine upload --repository-url https://test.pypi.org/legacy/ dist/* | |
python -m twine upload dist/* |
This file contains 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 | |
from sklearn import linear_model | |
from sklearn.model_selection import train_test_split | |
# In general for the way to do type hinting is very straight forward. | |
# simply don't instantiate the class to use it as a 'type' | |
# Here's a generic example: |
NewerOlder