Skip to content

Instantly share code, notes, and snippets.

View erdogant's full-sized avatar
🏠
Building from home

Erdogan erdogant

🏠
Building from home
View GitHub Profile
# Make edits in the dataframe.
d3.edge_properties
# label x y ... stroke opacity tooltip
# 0 acc 0.796433 0.745925 ... #000000 0.8 acc <br /> Survival: 44.5
# 1 acc 0.795550 0.739818 ... #000000 0.8 acc <br /> Survival: 55.0
# 2 acc 0.793272 0.739995 ... #000000 0.8 acc <br /> Survival: 63.8
# 3 acc 0.803293 0.747982 ... #000000 0.8 acc <br /> Survival: 11.9
# 4 acc 0.793152 0.725707 ... #000000 0.8 acc <br /> Survival: 79.7
# ... ... ... ... ... ... ...
# Load library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks(frame=True)
# Import example
df = d3.import_example('cancer')
# Setup the tooltip
tooltip=df['labels'].values + ' <br /> Survival: ' + df['survival_months'].astype(str).str[0:4].values
# Create interactive scatter plot
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Make scatter
d3.scatter(map_pca[:,0],
map_pca[:,1],
x1=map_tsne[:,0],
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Make particles
d3.particles('D3Blocks', collision=0.05, spacing=10, figsize=[1200, 500])
@erdogant
erdogant / d3blocks_violin.py
Last active February 4, 2023 23:06
d3blocks
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# import example
df = d3.import_example('cancer')
# Tooltip
##########################################
# Import Titanc dataset and preprocessing.
##########################################
df = hgb.import_example(data='titanic')
print(df)
# PassengerId Survived Pclass ... Fare Cabin Embarked
# 0 1 0 3 ... 7.2500 NaN S
# 1 2 1 1 ... 71.2833 C85 C
#######################################################
# Import Titanic dataset, and preprocessing
#######################################################
# Import the Titanic dataset
df = hgb.import_example(data='titanic')
print(df)
# PassengerId Survived Pclass ... Fare Cabin Embarked
# 0 1 0 3 ... 7.2500 NaN S
# 1 2 1 1 ... 71.2833 C85 C
# Import library
from hgboost import hgboost
# Initialize with default settings.
hgb = hgboost()
# hgb = hgboost(max_eval=250, threshold=0.5, cv=5, test_size=0.2, val_size=0.2, top_cv_evals=10, random_state=1, verbose=3)
# Load example Titanic Dataset
df = hgb.import_example()
import pandas as pd
# Create example dataset
df = pd.DataFrame()
df['source']= ['A', 'A', 'B', 'C', 'D']
df['target']= ['F', 'C', 'E', 'D', 'E']
df['weight']= [1, 1, 1, 1, 1]
print(df)
# source target weight
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example('energy')
# Input parameters.