SynthGen
Introduction
SynthGen is a string generator that generates name-like strings for synthesising name identifiers.
The main goal for developing SynthGen is to create strings that shares the characteristics of a known population.
This version of SynthGen generates low fidelity sex and ethnicity.
Users can tailor:
Total number of terms to generate: total_strings (int) (1,000)
characteristics related to gender/ethnicity
Proportion of names are unique (not correct yet): unique_percentage (int) (0.5)
Proportion of gender: gender_settings (dict) {'Male': 0.4, 'Female': 0.6}
Proportion of Strings overlapped by gender: gender_overlap_percentage (int) (0.15)
Proportion of ethnicity: ethnicity_settings (dict) {'White': 0.81, 'Asian': 0.096, 'Black': 0.042, 'Mixed': 0.03, 'Other': 0.022}
Proportion of Strings overlapped by ethnicity: ethnicity_overlap_percentages (dict) {('White', 'Black'): 0.1, ('White', 'Asian'): 0.05, ('White', 'Other'): 0.1}
String related characteristics:
string_settings = {
'lengths': [4, 5, 6, 7], # Specify lengths
'length_probabilities': [0.15, 0.3, 0.4, 0.15], # Specify length probabilities
'num_terms_range': [1, 2, 3], # Specify number of terms range
'num_terms_probabilities': [0.2, 0.6, 0.2] # Specify number of terms probabilities
}
Future direction - 1
Other string characteristics will be introduced to tailor, such as:
- apostrophes, hyphens, non-ISO characters
- vowel-consonant ratios
Uniqueness of terms will be a key goal to be retained, by gender and ethnicity.
Future direction - 2
To implement a insight tool to generate settings based on the loaded dataframe, and generate strings that match the characteristics of the loaded dataset.
Current work-around looks like:
uniqueness_requirements = { ('White', 'Male'): 0.85, ('White', 'Female'): 0.80, ('Black', 'Male'): 0.90, ('Black', 'Female'): 0.75, # Add more combinations as needed }
df = pd.read_csv('output_from_SynthGen.csv') grouped_df = df.groupby(['Ethnicity', 'Gender'])
for group, group_data in grouped_df: # Get the desired uniqueness for the current group from the dictionary desired_uniqueness = uniqueness_requirements.get(group, 0.8) # Default to 0.8 if not specified
# Calculate the number of unique names needed for the group based on desired uniqueness
total_names = len(group_data)
unique_names_needed = int(desired_uniqueness * total_names)
# Apply your sampling technique to ensure the desired level of uniqueness
# Replace this with your actual sampling logic
sampled_data = group_data.sample(unique_names_needed)
# Append the sampled data to the subsample DataFrame
subsample_df = subsample_df.append(sampled_data)
subsample_df.to_csv('subsampled_data.csv', index=False)
Metadata
Release files for synthgen 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| synthgen-0.1.1.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| synthgen-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / synthgen-0.1.1.tar.gz
| Download URL | synthgen-0.1.1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9638de7975d4dc12d620146278b6f048f63237445924c8f457f9ff6d4484c0fc
|
|
BLAKE2b-256 checksum How to use checksums |
107f6c843807d484e4bfe2af932f07240ee020a81229aad6450d5d48b02b27de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.5 Windows/10
|
Release files / synthgen-0.1.1-py3-none-any.whl
| Download URL | synthgen-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2b0d74fb69d46fd89bdd03632f780524ad8b15588eb706c97df0634c0ded095
|
|
BLAKE2b-256 checksum How to use checksums |
c55916952fa6645615b01230205725b561d083a7b8d65e7aa8ebc0441c78329d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.5 Windows/10
|