Simplify dataset: disable viewer, remove visualizations and examples
Browse files- .dataset_viewer_config.json +3 -0
- README.md +6 -56
- create_visualizations.py +0 -248
- examples/README.md +0 -34
- examples/basic_usage.py +0 -74
- visualizations/flat_bee_hist.png +0 -3
- visualizations/flat_boxplots.png +0 -3
- visualizations/flat_butterfly_bar.png +0 -3
- visualizations/flat_cat_bar.png +0 -3
- visualizations/flat_cat_grid.png +0 -3
- visualizations/flat_chicken_hist.png +0 -3
- visualizations/flat_correlation.png +0 -3
- visualizations/flat_correlation_2.png +0 -3
- visualizations/flat_deer_hist.png +0 -3
- visualizations/flat_dog_hist.png +0 -3
- visualizations/flat_dolphin_hist.png +0 -3
- visualizations/flat_flamingo_hist.png +0 -3
- visualizations/flat_goat_bar.png +0 -3
- visualizations/flat_hedgehog_hist.png +0 -3
- visualizations/flat_koala_bar.png +0 -3
- visualizations/flat_llama_bar.png +0 -3
- visualizations/flat_otter_bar.png +0 -3
- visualizations/flat_pairplot.png +0 -3
- visualizations/flat_panda_hist.png +0 -3
- visualizations/flat_squirrel_hist.png +0 -3
- visualizations/seq_alice_bar.png +0 -3
- visualizations/seq_boxplots.png +0 -3
- visualizations/seq_cat_grid.png +0 -3
- visualizations/seq_correlation.png +0 -3
- visualizations/seq_david_hist.png +0 -3
- visualizations/seq_emily_bar.png +0 -3
- visualizations/seq_james_hist.png +0 -3
- visualizations/seq_john_bar.png +0 -3
- visualizations/seq_lucas_hist.png +0 -3
- visualizations/seq_mary_hist.png +0 -3
- visualizations/seq_mike_hist.png +0 -3
- visualizations/seq_pairplot.png +0 -3
- visualizations/seq_sarah_hist.png +0 -3
.dataset_viewer_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"disabled": true
|
| 3 |
+
}
|
README.md
CHANGED
|
@@ -5,6 +5,12 @@ tags:
|
|
| 5 |
- synthetic-data
|
| 6 |
datasets:
|
| 7 |
- mostlyaiprize
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# MOSTLY AI Prize Dataset
|
|
@@ -62,62 +68,6 @@ flat_df = pd.read_csv('data/flat/train/flat-training.csv.gz', compression='gzip'
|
|
| 62 |
sequential_df = pd.read_csv('data/sequential/train/sequential-training.csv.gz', compression='gzip')
|
| 63 |
```
|
| 64 |
|
| 65 |
-
### Dataset Visualizations
|
| 66 |
-
|
| 67 |
-
#### Flat Dataset Visualizations
|
| 68 |
-
|
| 69 |
-
Here's a preview of some data distributions in the flat dataset:
|
| 70 |
-
|
| 71 |
-
<div class="flex flex-col space-y-4">
|
| 72 |
-
<div class="flex flex-row space-x-4">
|
| 73 |
-
<div class="w-1/2">
|
| 74 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/flat_dog_hist.png" alt="Distribution of 'dog' values" />
|
| 75 |
-
<p class="text-center">Distribution of 'dog' values</p>
|
| 76 |
-
</div>
|
| 77 |
-
<div class="w-1/2">
|
| 78 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/flat_deer_hist.png" alt="Distribution of 'deer' values" />
|
| 79 |
-
<p class="text-center">Distribution of 'deer' values</p>
|
| 80 |
-
</div>
|
| 81 |
-
</div>
|
| 82 |
-
<div class="flex flex-row space-x-4">
|
| 83 |
-
<div class="w-1/2">
|
| 84 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/flat_cat_bar.png" alt="Count of 'cat' categories" />
|
| 85 |
-
<p class="text-center">Count of 'cat' categories</p>
|
| 86 |
-
</div>
|
| 87 |
-
<div class="w-1/2">
|
| 88 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/flat_correlation.png" alt="Correlation heatmap" />
|
| 89 |
-
<p class="text-center">Correlation heatmap</p>
|
| 90 |
-
</div>
|
| 91 |
-
</div>
|
| 92 |
-
</div>
|
| 93 |
-
|
| 94 |
-
#### Sequential Dataset Visualizations
|
| 95 |
-
|
| 96 |
-
Here's a preview of some data distributions in the sequential dataset:
|
| 97 |
-
|
| 98 |
-
<div class="flex flex-col space-y-4">
|
| 99 |
-
<div class="flex flex-row space-x-4">
|
| 100 |
-
<div class="w-1/2">
|
| 101 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/seq_mike_hist.png" alt="Distribution of 'mike' values" />
|
| 102 |
-
<p class="text-center">Distribution of 'mike' values</p>
|
| 103 |
-
</div>
|
| 104 |
-
<div class="w-1/2">
|
| 105 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/seq_david_hist.png" alt="Distribution of 'david' values" />
|
| 106 |
-
<p class="text-center">Distribution of 'david' values</p>
|
| 107 |
-
</div>
|
| 108 |
-
</div>
|
| 109 |
-
<div class="flex flex-row space-x-4">
|
| 110 |
-
<div class="w-1/2">
|
| 111 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/seq_alice_bar.png" alt="Count of 'alice' categories" />
|
| 112 |
-
<p class="text-center">Count of 'alice' categories</p>
|
| 113 |
-
</div>
|
| 114 |
-
<div class="w-1/2">
|
| 115 |
-
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/seq_correlation.png" alt="Correlation heatmap" />
|
| 116 |
-
<p class="text-center">Correlation heatmap</p>
|
| 117 |
-
</div>
|
| 118 |
-
</div>
|
| 119 |
-
</div>
|
| 120 |
-
|
| 121 |
### Column Description
|
| 122 |
|
| 123 |
Note: Detailed column descriptions are intentionally not provided as part of the competition challenge. The task is to generate synthetic data that preserves the statistical properties of the original data without needing to understand the semantic meaning of each column.
|
|
|
|
| 5 |
- synthetic-data
|
| 6 |
datasets:
|
| 7 |
- mostlyaiprize
|
| 8 |
+
extra_gated_prompt: "This is a competition dataset for the MOSTLY AI Prize"
|
| 9 |
+
extra_gated_fields:
|
| 10 |
+
Name: text
|
| 11 |
+
Email: text
|
| 12 |
+
Affiliation: text
|
| 13 |
+
viewer: false
|
| 14 |
---
|
| 15 |
|
| 16 |
# MOSTLY AI Prize Dataset
|
|
|
|
| 68 |
sequential_df = pd.read_csv('data/sequential/train/sequential-training.csv.gz', compression='gzip')
|
| 69 |
```
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
### Column Description
|
| 72 |
|
| 73 |
Note: Detailed column descriptions are intentionally not provided as part of the competition challenge. The task is to generate synthetic data that preserves the statistical properties of the original data without needing to understand the semantic meaning of each column.
|
create_visualizations.py
DELETED
|
@@ -1,248 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
Generate visualizations for the MOSTLY AI Prize dataset
|
| 4 |
-
to enhance the Hugging Face dataset preview.
|
| 5 |
-
"""
|
| 6 |
-
|
| 7 |
-
import os
|
| 8 |
-
import pandas as pd
|
| 9 |
-
import matplotlib.pyplot as plt
|
| 10 |
-
import seaborn as sns
|
| 11 |
-
import numpy as np
|
| 12 |
-
|
| 13 |
-
# Configure visualizations
|
| 14 |
-
plt.style.use('ggplot')
|
| 15 |
-
sns.set(style="whitegrid")
|
| 16 |
-
plt.rcParams['figure.figsize'] = (10, 6)
|
| 17 |
-
plt.rcParams['figure.dpi'] = 100
|
| 18 |
-
|
| 19 |
-
# Create output directory
|
| 20 |
-
os.makedirs('visualizations', exist_ok=True)
|
| 21 |
-
|
| 22 |
-
def load_data():
|
| 23 |
-
"""Load both datasets"""
|
| 24 |
-
data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
|
| 25 |
-
|
| 26 |
-
flat_file = os.path.join(data_dir, "flat-training.csv.gz")
|
| 27 |
-
flat_df = pd.read_csv(flat_file, compression='gzip')
|
| 28 |
-
|
| 29 |
-
seq_file = os.path.join(data_dir, "sequential-training.csv.gz")
|
| 30 |
-
seq_df = pd.read_csv(seq_file, compression='gzip')
|
| 31 |
-
|
| 32 |
-
return flat_df, seq_df
|
| 33 |
-
|
| 34 |
-
def create_histogram(df, column, title, filename):
|
| 35 |
-
"""Create a histogram for a numeric column"""
|
| 36 |
-
plt.figure(figsize=(10, 6))
|
| 37 |
-
|
| 38 |
-
# For integer columns
|
| 39 |
-
if pd.api.types.is_integer_dtype(df[column]):
|
| 40 |
-
sns.histplot(df[column], kde=True, bins=30)
|
| 41 |
-
else: # For float columns
|
| 42 |
-
sns.histplot(df[column], kde=True, bins=30)
|
| 43 |
-
|
| 44 |
-
plt.title(title)
|
| 45 |
-
plt.xlabel(column)
|
| 46 |
-
plt.ylabel('Count')
|
| 47 |
-
plt.tight_layout()
|
| 48 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 49 |
-
plt.close()
|
| 50 |
-
|
| 51 |
-
def create_bar_chart(df, column, title, filename):
|
| 52 |
-
"""Create a bar chart for a categorical column"""
|
| 53 |
-
plt.figure(figsize=(10, 6))
|
| 54 |
-
|
| 55 |
-
# Get value counts and limit to top 20 categories if there are many
|
| 56 |
-
value_counts = df[column].value_counts().reset_index()
|
| 57 |
-
value_counts.columns = [column, 'count']
|
| 58 |
-
|
| 59 |
-
if len(value_counts) > 20:
|
| 60 |
-
value_counts = value_counts.head(20)
|
| 61 |
-
title += " (Top 20)"
|
| 62 |
-
|
| 63 |
-
# Plot horizontal bar chart
|
| 64 |
-
sns.barplot(y=column, x='count', data=value_counts)
|
| 65 |
-
|
| 66 |
-
plt.title(title)
|
| 67 |
-
plt.xlabel('Count')
|
| 68 |
-
plt.ylabel(column)
|
| 69 |
-
plt.tight_layout()
|
| 70 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 71 |
-
plt.close()
|
| 72 |
-
|
| 73 |
-
def create_correlation_heatmap(df, title, filename, max_columns=20, column_subset=None):
|
| 74 |
-
"""Create a correlation heatmap for numeric columns"""
|
| 75 |
-
plt.figure(figsize=(14, 12))
|
| 76 |
-
|
| 77 |
-
# Get numeric columns
|
| 78 |
-
numeric_df = df.select_dtypes(include=['number'])
|
| 79 |
-
|
| 80 |
-
# If specific columns are provided, use those
|
| 81 |
-
if column_subset:
|
| 82 |
-
numeric_subset = [col for col in column_subset if col in numeric_df.columns]
|
| 83 |
-
if numeric_subset:
|
| 84 |
-
numeric_df = numeric_df[numeric_subset]
|
| 85 |
-
|
| 86 |
-
# If there are too many columns, select a subset
|
| 87 |
-
if numeric_df.shape[1] > max_columns:
|
| 88 |
-
numeric_df = numeric_df.iloc[:, :max_columns]
|
| 89 |
-
|
| 90 |
-
# Create correlation matrix
|
| 91 |
-
corr = numeric_df.corr()
|
| 92 |
-
|
| 93 |
-
# Create heatmap
|
| 94 |
-
mask = np.triu(np.ones_like(corr, dtype=bool))
|
| 95 |
-
sns.heatmap(corr, mask=mask, cmap="coolwarm", vmin=-1, vmax=1,
|
| 96 |
-
annot=True, fmt=".2f", square=True, linewidths=.5)
|
| 97 |
-
|
| 98 |
-
plt.title(title)
|
| 99 |
-
plt.tight_layout()
|
| 100 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 101 |
-
plt.close()
|
| 102 |
-
|
| 103 |
-
def create_pairplot(df, columns, title, filename):
|
| 104 |
-
"""Create a pairplot for selected numeric columns"""
|
| 105 |
-
plt.figure(figsize=(15, 15))
|
| 106 |
-
|
| 107 |
-
# Create subset with the selected columns
|
| 108 |
-
subset_df = df[columns].copy()
|
| 109 |
-
|
| 110 |
-
# Create pairplot
|
| 111 |
-
g = sns.pairplot(subset_df, diag_kind="kde", markers="o", plot_kws={"alpha": 0.6})
|
| 112 |
-
g.fig.suptitle(title, y=1.02)
|
| 113 |
-
|
| 114 |
-
plt.tight_layout()
|
| 115 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 116 |
-
plt.close()
|
| 117 |
-
|
| 118 |
-
def create_boxplot_grid(df, columns, title, filename, ncols=4):
|
| 119 |
-
"""Create a grid of boxplots for selected numeric columns"""
|
| 120 |
-
# Calculate how many rows we need
|
| 121 |
-
nrows = (len(columns) + ncols - 1) // ncols
|
| 122 |
-
|
| 123 |
-
# Create the subplots
|
| 124 |
-
fig, axes = plt.subplots(nrows=nrows, ncols=ncols, figsize=(16, 3 * nrows))
|
| 125 |
-
axes = axes.flatten()
|
| 126 |
-
|
| 127 |
-
# Create a boxplot for each column
|
| 128 |
-
for i, col in enumerate(columns):
|
| 129 |
-
if i < len(axes):
|
| 130 |
-
if col in df.columns and pd.api.types.is_numeric_dtype(df[col]):
|
| 131 |
-
sns.boxplot(x=df[col], ax=axes[i])
|
| 132 |
-
axes[i].set_title(col)
|
| 133 |
-
axes[i].set_xlabel('')
|
| 134 |
-
|
| 135 |
-
# Hide unused subplots
|
| 136 |
-
for i in range(len(columns), len(axes)):
|
| 137 |
-
axes[i].set_visible(False)
|
| 138 |
-
|
| 139 |
-
plt.suptitle(title, fontsize=16)
|
| 140 |
-
plt.tight_layout()
|
| 141 |
-
plt.subplots_adjust(top=0.9)
|
| 142 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 143 |
-
plt.close()
|
| 144 |
-
|
| 145 |
-
def create_categorical_distribution_grid(df, columns, title, filename, ncols=3):
|
| 146 |
-
"""Create a grid of bar charts for selected categorical columns"""
|
| 147 |
-
# Calculate how many rows we need
|
| 148 |
-
nrows = (len(columns) + ncols - 1) // ncols
|
| 149 |
-
|
| 150 |
-
# Create the subplots
|
| 151 |
-
fig, axes = plt.subplots(nrows=nrows, ncols=ncols, figsize=(16, 4 * nrows))
|
| 152 |
-
axes = axes.flatten()
|
| 153 |
-
|
| 154 |
-
# Create a bar chart for each column
|
| 155 |
-
for i, col in enumerate(columns):
|
| 156 |
-
if i < len(axes):
|
| 157 |
-
if col in df.columns and not pd.api.types.is_numeric_dtype(df[col]):
|
| 158 |
-
# Get value counts and limit to top 10
|
| 159 |
-
value_counts = df[col].value_counts().nlargest(10)
|
| 160 |
-
value_counts.plot(kind='barh', ax=axes[i])
|
| 161 |
-
axes[i].set_title(f"{col} (Top 10 Categories)")
|
| 162 |
-
axes[i].set_xlabel('Count')
|
| 163 |
-
|
| 164 |
-
# Hide unused subplots
|
| 165 |
-
for i in range(len(columns), len(axes)):
|
| 166 |
-
axes[i].set_visible(False)
|
| 167 |
-
|
| 168 |
-
plt.suptitle(title, fontsize=16)
|
| 169 |
-
plt.tight_layout()
|
| 170 |
-
plt.subplots_adjust(top=0.9)
|
| 171 |
-
plt.savefig(os.path.join('visualizations', filename))
|
| 172 |
-
plt.close()
|
| 173 |
-
|
| 174 |
-
def main():
|
| 175 |
-
"""Main function to generate all visualizations"""
|
| 176 |
-
print("Generating visualizations for MOSTLY AI Prize dataset...")
|
| 177 |
-
|
| 178 |
-
# Load data
|
| 179 |
-
flat_df, seq_df = load_data()
|
| 180 |
-
|
| 181 |
-
# Create visualizations for flat dataset
|
| 182 |
-
print("Creating visualizations for flat dataset...")
|
| 183 |
-
|
| 184 |
-
# Histograms for selected numeric columns
|
| 185 |
-
numeric_cols_flat = ['dog', 'panda', 'squirrel', 'dolphin', 'deer', 'hedgehog', 'chicken', 'bee', 'flamingo']
|
| 186 |
-
for col in numeric_cols_flat:
|
| 187 |
-
if col in flat_df.columns and pd.api.types.is_numeric_dtype(flat_df[col]):
|
| 188 |
-
create_histogram(flat_df, col, f'Distribution of {col} values', f'flat_{col}_hist.png')
|
| 189 |
-
|
| 190 |
-
# Bar charts for selected categorical columns
|
| 191 |
-
cat_cols_flat = ['cat', 'rabbit', 'koala', 'otter', 'lamb', 'goat', 'cow', 'horse', 'llama', 'butterfly']
|
| 192 |
-
for col in cat_cols_flat:
|
| 193 |
-
if col in flat_df.columns and not pd.api.types.is_numeric_dtype(flat_df[col]):
|
| 194 |
-
create_bar_chart(flat_df, col, f'Count of {col} categories', f'flat_{col}_bar.png')
|
| 195 |
-
|
| 196 |
-
# Grid of boxplots for numeric columns
|
| 197 |
-
create_boxplot_grid(flat_df, numeric_cols_flat, 'Boxplots of Selected Numeric Variables - Flat Dataset', 'flat_boxplots.png')
|
| 198 |
-
|
| 199 |
-
# Grid of bar charts for categorical columns
|
| 200 |
-
create_categorical_distribution_grid(flat_df, cat_cols_flat, 'Distribution of Selected Categorical Variables - Flat Dataset', 'flat_cat_grid.png')
|
| 201 |
-
|
| 202 |
-
# Correlation heatmap for first 20 numeric columns
|
| 203 |
-
create_correlation_heatmap(flat_df, 'Correlation Heatmap - Flat Dataset (First 20 Numeric Columns)', 'flat_correlation.png', max_columns=20)
|
| 204 |
-
|
| 205 |
-
# Correlation heatmap for next 20 numeric columns (21-40)
|
| 206 |
-
numeric_cols_flat_next20 = flat_df.select_dtypes(include=['number']).columns[20:40].tolist()
|
| 207 |
-
if len(numeric_cols_flat_next20) > 0:
|
| 208 |
-
create_correlation_heatmap(flat_df, 'Correlation Heatmap - Flat Dataset (Numeric Columns 21-40)', 'flat_correlation_2.png', column_subset=numeric_cols_flat_next20)
|
| 209 |
-
|
| 210 |
-
# Pairplot for selected key variables
|
| 211 |
-
key_vars = ['dog', 'deer', 'hedgehog', 'penguin']
|
| 212 |
-
if all(col in flat_df.columns for col in key_vars):
|
| 213 |
-
create_pairplot(flat_df, key_vars, 'Relationships Between Key Variables - Flat Dataset', 'flat_pairplot.png')
|
| 214 |
-
|
| 215 |
-
# Create visualizations for sequential dataset
|
| 216 |
-
print("Creating visualizations for sequential dataset...")
|
| 217 |
-
|
| 218 |
-
# Histograms for numeric columns
|
| 219 |
-
numeric_cols_seq = ['david', 'james', 'mike', 'lucas', 'mary', 'sarah']
|
| 220 |
-
for col in numeric_cols_seq:
|
| 221 |
-
if col in seq_df.columns and pd.api.types.is_numeric_dtype(seq_df[col]):
|
| 222 |
-
create_histogram(seq_df, col, f'Distribution of {col} values', f'seq_{col}_hist.png')
|
| 223 |
-
|
| 224 |
-
# Bar charts for categorical columns
|
| 225 |
-
cat_cols_seq = ['alice', 'emily', 'jacob', 'john']
|
| 226 |
-
for col in cat_cols_seq:
|
| 227 |
-
if col in seq_df.columns and not pd.api.types.is_numeric_dtype(seq_df[col]):
|
| 228 |
-
create_bar_chart(seq_df, col, f'Count of {col} categories', f'seq_{col}_bar.png')
|
| 229 |
-
|
| 230 |
-
# Grid of boxplots for numeric columns
|
| 231 |
-
create_boxplot_grid(seq_df, numeric_cols_seq, 'Boxplots of Selected Numeric Variables - Sequential Dataset', 'seq_boxplots.png')
|
| 232 |
-
|
| 233 |
-
# Grid of bar charts for categorical columns
|
| 234 |
-
create_categorical_distribution_grid(seq_df, cat_cols_seq, 'Distribution of Selected Categorical Variables - Sequential Dataset', 'seq_cat_grid.png')
|
| 235 |
-
|
| 236 |
-
# Correlation heatmap
|
| 237 |
-
create_correlation_heatmap(seq_df, 'Correlation Heatmap - Sequential Dataset', 'seq_correlation.png')
|
| 238 |
-
|
| 239 |
-
# Pairplot for selected key variables
|
| 240 |
-
key_vars_seq = ['david', 'james', 'lucas', 'mary']
|
| 241 |
-
if all(col in seq_df.columns for col in key_vars_seq):
|
| 242 |
-
create_pairplot(seq_df, key_vars_seq, 'Relationships Between Key Variables - Sequential Dataset', 'seq_pairplot.png')
|
| 243 |
-
|
| 244 |
-
print("Visualizations created successfully in the 'visualizations' directory.")
|
| 245 |
-
print("Upload these images to Hugging Face to complete the dataset preview enhancement.")
|
| 246 |
-
|
| 247 |
-
if __name__ == "__main__":
|
| 248 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
examples/README.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
| 1 |
-
# MOSTLY AI Prize Dataset Examples
|
| 2 |
-
|
| 3 |
-
This directory contains example scripts for working with the MOSTLY AI Prize dataset.
|
| 4 |
-
|
| 5 |
-
## Contents
|
| 6 |
-
|
| 7 |
-
- `basic_usage.py`: A script showing how to load the dataset, train a generative model, and create synthetic data using the MOSTLY AI SDK
|
| 8 |
-
|
| 9 |
-
## Requirements
|
| 10 |
-
|
| 11 |
-
To run the example scripts, you'll need the following packages:
|
| 12 |
-
|
| 13 |
-
```
|
| 14 |
-
pip install mostlyai[local] pandas matplotlib seaborn
|
| 15 |
-
```
|
| 16 |
-
|
| 17 |
-
## Usage
|
| 18 |
-
|
| 19 |
-
You can run the example script using:
|
| 20 |
-
|
| 21 |
-
```bash
|
| 22 |
-
python basic_usage.py
|
| 23 |
-
```
|
| 24 |
-
|
| 25 |
-
The script demonstrates:
|
| 26 |
-
1. Loading data directly from CSV files
|
| 27 |
-
2. Training a generative model using the MOSTLY AI SDK in local mode
|
| 28 |
-
3. Generating synthetic data with the same structure as the original
|
| 29 |
-
4. Saving the synthetic data for submission
|
| 30 |
-
|
| 31 |
-
## Additional Resources
|
| 32 |
-
|
| 33 |
-
- [MOSTLY AI Prize Competition](https://www.mostlyaiprize.com/)
|
| 34 |
-
- [Synthetic Data Quality Assurance Toolkit](https://github.com/mostly-ai/mostlyai-qa)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
examples/basic_usage.py
DELETED
|
@@ -1,74 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env python3
|
| 2 |
-
"""
|
| 3 |
-
MOSTLY AI Prize Dataset - Basic Usage Example
|
| 4 |
-
|
| 5 |
-
This script demonstrates how to load the MOSTLY AI Prize dataset,
|
| 6 |
-
train a generative model, and create synthetic data using the MOSTLY AI SDK.
|
| 7 |
-
"""
|
| 8 |
-
|
| 9 |
-
import os
|
| 10 |
-
import pandas as pd
|
| 11 |
-
import matplotlib.pyplot as plt
|
| 12 |
-
import seaborn as sns
|
| 13 |
-
|
| 14 |
-
def main():
|
| 15 |
-
"""Main function to demonstrate dataset usage"""
|
| 16 |
-
print("MOSTLY AI Prize Dataset - Basic Usage Example")
|
| 17 |
-
print("=" * 50)
|
| 18 |
-
|
| 19 |
-
# Install the MOSTLY AI SDK
|
| 20 |
-
print("Installing MOSTLY AI SDK...")
|
| 21 |
-
import subprocess
|
| 22 |
-
subprocess.run(["pip", "install", "mostlyai[local]"])
|
| 23 |
-
|
| 24 |
-
# Load the flat training data
|
| 25 |
-
print("Loading data...")
|
| 26 |
-
data_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "data")
|
| 27 |
-
flat_file = os.path.join(data_dir, "flat-training.csv.gz")
|
| 28 |
-
trn = pd.read_csv(flat_file)
|
| 29 |
-
|
| 30 |
-
print(f"Loaded data with shape: {trn.shape}")
|
| 31 |
-
print(f"Columns: {', '.join(trn.columns[:5])}...")
|
| 32 |
-
|
| 33 |
-
# Train a generative model using MOSTLY AI SDK
|
| 34 |
-
print("\nTraining a generative model...")
|
| 35 |
-
from mostlyai.sdk import MostlyAI
|
| 36 |
-
|
| 37 |
-
# Instantiate SDK in LOCAL mode
|
| 38 |
-
mostly = MostlyAI(local=True)
|
| 39 |
-
|
| 40 |
-
# Train a generator (limiting training time to 1 minute for this example)
|
| 41 |
-
g = mostly.train(config={'tables': [{
|
| 42 |
-
'name': 'flat',
|
| 43 |
-
'data': trn, # your training data
|
| 44 |
-
'tabular_model_configuration': {
|
| 45 |
-
'max_training_time': 1, # limit training to 1 minute
|
| 46 |
-
}
|
| 47 |
-
}]})
|
| 48 |
-
|
| 49 |
-
# Generate synthetic data
|
| 50 |
-
print("\nGenerating synthetic data...")
|
| 51 |
-
sd = mostly.generate(g)
|
| 52 |
-
syn = sd.data()
|
| 53 |
-
|
| 54 |
-
# Save the synthetic dataset
|
| 55 |
-
output_file = os.path.join(data_dir, "flat-synthetic.csv.gz")
|
| 56 |
-
syn.to_csv(output_file, index=False)
|
| 57 |
-
print(f"Synthetic data saved to: {output_file}")
|
| 58 |
-
|
| 59 |
-
# Compare original and synthetic data
|
| 60 |
-
print("\nComparing first 5 rows of original data:")
|
| 61 |
-
print(trn.head())
|
| 62 |
-
|
| 63 |
-
print("\nComparing first 5 rows of synthetic data:")
|
| 64 |
-
print(syn.head())
|
| 65 |
-
|
| 66 |
-
print("\n--- Next Steps ---")
|
| 67 |
-
print("1. Adjust model parameters to improve synthetic data quality")
|
| 68 |
-
print("2. Use the Synthetic Data Quality Assurance toolkit to evaluate your results:")
|
| 69 |
-
print(" https://github.com/mostly-ai/mostlyai-qa")
|
| 70 |
-
print("3. Submit your synthetic data for the MOSTLY AI Prize competition")
|
| 71 |
-
print("\nFor more information, visit: https://www.mostlyaiprize.com/")
|
| 72 |
-
|
| 73 |
-
if __name__ == "__main__":
|
| 74 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
visualizations/flat_bee_hist.png
DELETED
Git LFS Details
|
visualizations/flat_boxplots.png
DELETED
Git LFS Details
|
visualizations/flat_butterfly_bar.png
DELETED
Git LFS Details
|
visualizations/flat_cat_bar.png
DELETED
Git LFS Details
|
visualizations/flat_cat_grid.png
DELETED
Git LFS Details
|
visualizations/flat_chicken_hist.png
DELETED
Git LFS Details
|
visualizations/flat_correlation.png
DELETED
Git LFS Details
|
visualizations/flat_correlation_2.png
DELETED
Git LFS Details
|
visualizations/flat_deer_hist.png
DELETED
Git LFS Details
|
visualizations/flat_dog_hist.png
DELETED
Git LFS Details
|
visualizations/flat_dolphin_hist.png
DELETED
Git LFS Details
|
visualizations/flat_flamingo_hist.png
DELETED
Git LFS Details
|
visualizations/flat_goat_bar.png
DELETED
Git LFS Details
|
visualizations/flat_hedgehog_hist.png
DELETED
Git LFS Details
|
visualizations/flat_koala_bar.png
DELETED
Git LFS Details
|
visualizations/flat_llama_bar.png
DELETED
Git LFS Details
|
visualizations/flat_otter_bar.png
DELETED
Git LFS Details
|
visualizations/flat_pairplot.png
DELETED
Git LFS Details
|
visualizations/flat_panda_hist.png
DELETED
Git LFS Details
|
visualizations/flat_squirrel_hist.png
DELETED
Git LFS Details
|
visualizations/seq_alice_bar.png
DELETED
Git LFS Details
|
visualizations/seq_boxplots.png
DELETED
Git LFS Details
|
visualizations/seq_cat_grid.png
DELETED
Git LFS Details
|
visualizations/seq_correlation.png
DELETED
Git LFS Details
|
visualizations/seq_david_hist.png
DELETED
Git LFS Details
|
visualizations/seq_emily_bar.png
DELETED
Git LFS Details
|
visualizations/seq_james_hist.png
DELETED
Git LFS Details
|
visualizations/seq_john_bar.png
DELETED
Git LFS Details
|
visualizations/seq_lucas_hist.png
DELETED
Git LFS Details
|
visualizations/seq_mary_hist.png
DELETED
Git LFS Details
|
visualizations/seq_mike_hist.png
DELETED
Git LFS Details
|
visualizations/seq_pairplot.png
DELETED
Git LFS Details
|
visualizations/seq_sarah_hist.png
DELETED
Git LFS Details
|