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
version: '3' | |
services: | |
notebook: | |
build: | |
context: ./jupyter-notebook-docker | |
ports: | |
- "8888:8888" | |
depends_on: | |
- mlflow | |
environment: |
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 create_encoder(latent_dim, cat_dim, window_size, input_dim): | |
input_layer = Input(shape=(window_size, input_dim)) | |
code = TimeDistributed(Dense(64, activation='linear'))(input_layer) | |
code = Bidirectional(LSTM(128, return_sequences=True))(code) | |
code = BatchNormalization()(code) | |
code = ELU()(code) | |
code = Bidirectional(LSTM(64))(code) | |
code = BatchNormalization()(code) | |
code = ELU()(code) |
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 create_discriminator(latent_dim): | |
input_layer = Input(shape=(latent_dim,)) | |
disc = Dense(128)(input_layer) | |
disc = ELU()(disc) | |
disc = Dense(64)(disc) | |
disc = ELU()(disc) | |
disc = Dense(1, activation="sigmoid")(disc) | |
model = Model(input_layer, disc) | |
return model |
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
window_size = train_x.shape[1] | |
input_dim = train_x.shape[2] | |
latent_dim = 32 | |
cat_dim = 8 | |
prior_discriminator = create_discriminator(latent_dim) | |
prior_discriminator.compile(loss='binary_crossentropy', | |
optimizer=Nadam(0.0002, 0.5), | |
metrics=['accuracy']) |
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
batches = 10000 | |
batch_size=64 | |
losses_disc = [] | |
losses_disc_cat = [] | |
losses_ae = [] | |
losses_val = [] | |
real = np.ones((batch_size, 1)) | |
fake = np.zeros((batch_size, 1)) |
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
sealed class Try<T> { | |
companion object { | |
operator fun <T> invoke(func: () -> T): Try<T> = | |
try { | |
Success(func()) | |
} catch (error: Exception) { | |
Failure(error) | |
} | |
} |
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
fun main() { | |
val lines = Try { | |
File("./my-pets.csv").readLines().map { it.split(',') } | |
} | |
val pets : Try<List<Pet>> = lines.map { it.map(::toPet) } | |
when (pets) { | |
is Success -> println(pets.value) |
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
fun toPet(values: List<String>): Try<Pet> { | |
val name = values[0] | |
val ageTry = Try { values[1].toInt() } | |
val typeTry = PetType.lookup(values[2]) | |
return ageTry.flatMap { age -> typeTry.map { type -> Pet(name, age, type) } } | |
} | |
enum class PetType(val type: String) { |