Skip to content

Instantly share code, notes, and snippets.

@johntmyers
johntmyers / Gretel_CLA.md
Last active August 30, 2022 12:10
Gretel Contributor License Agreement
View Gretel_CLA.md

Overview

In order to clarify the intellectual property license granted with Contributions (as defined below) from any person or entity, Gretel Labs, Inc. (“Gretel.ai”) must have a Contributor License Agreement (“CLA”) on file that has been signed by each Contributor (as defined below), indicating agreement to the license terms below. This CLA is for Your protection as a Contributor as well as the protection of Gretel.ai and its users; it does not change Your rights to use Your own Contributions for any other purpose.

This CLA allows either an individual or an entity (a "Corporation") to submit Contributions to Gretel.ai, to authorize Contributions submitted by its employees or agents to Gretel.ai (in the case of a Corporation), and to grant copyright and patent licenses thereto.

Please read this document carefully and provide the Contributor information requested below before signing and keep a copy for Your records. If You have questions about this CLA, please contact Gretel.ai at hi@gretel.ai.

By sig

@johntmyers
johntmyers / create_report.py
Created October 7, 2020 15:40
Gretel Synthetics Report Generation
View create_report.py
# With the latest Premium SDK, you can write your report to a HTML file for archiving and distribution
# ... assuming you have a ``bundle`` object from previous synthetic workloads
bundle.generate_report(report_path="./my_report.html")
@johntmyers
johntmyers / sample.py
Last active August 11, 2020 20:29
shhgit-test.py
View sample.py
# le super secret
GRETEL_API_KEY=MYLOYALROYALSUBJECT
@johntmyers
johntmyers / response.json
Created July 1, 2020 16:27
Gretel Sync API Response Example
View response.json
{
"data": {
"records": [
{
"data": {
"Unnamed: 0": 2135731,
"Unnamed: 0.1": 2135731,
"id": null,
"member_id": null,
"loan_amnt": 12000,
@johntmyers
johntmyers / train_and_gen.py
Created June 15, 2020 19:29
gretel-synthetics-0.10.0-part3
View train_and_gen.py
# ``batcher`` is our ``DataFrameBatch`` instance
# this creates a DataFrame and a "train.csv" file for each of our batches
batcher.create_training_data()
# loops over all batches, and generates the models
batcher.train_all_batches()
# loops over all models, and generates synthetic lines for each one
#
@johntmyers
johntmyers / validator.py
Created June 15, 2020 19:06
gretel-synthetics-0.10.0-part2
View validator.py
# ``batcher`` is our ``DataFrameBatch`` instance
def my_validator(line: str) -> bool:
# ``str`` is a single line of generated text
# return a bool, True for valid, False for invalid
# throwing an Exception also invalidates the line
...
# set a validator function for our first batch
batcher.set_batch_validator(0, my_validator)
@johntmyers
johntmyers / init.py
Last active June 15, 2020 15:15
gretel-synthetics-0.10.0-example-1
View init.py
# pip install gretel-synthetics
from gretel_synthetics.batch import DataFrameBatch
# my_source_df = ...
# Same configurations parameters as using LocalConfig
# https://gretel-synthetics.readthedocs.io/en/stable/api/config.html
config_template = {
"max_lines": 0,
@johntmyers
johntmyers / converter.py
Last active May 22, 2020 19:50
String to regex converter
View converter.py
import re
def _sub_special_chars_any(in_string: str):
return re.sub("[^a-z\d\s]", ".?", in_string)
def _mark_substrings_optional(in_string: str, n=3):
parts = in_string.split()
if len(parts) == 1:
View keybase.md

Keybase proof

I hereby claim:

  • I am johntmyers on github.
  • I am johntmyers (https://keybase.io/johntmyers) on keybase.
  • I have a public key ASCqahqpY4OgOzF1bwaJlaMIsZRl9NTqNWVvmiPiHArQXwo

To claim this, I am signing this object: