DocsFirst Model
Your First ML Model
Build your first machine learning model with CyxWiz using the visual Node Editor or Python scripting.
Option 1: Using the Node Editor
- Launch CyxWiz Engine
- Create New Project:
File > New Project - Open Node Editor:
View > Node Editor - Build a Simple Network:
[Data Input] -> [Dense 784->128 ReLU] -> [Dense 128->10 Softmax] -> [Model Output]
Adding Nodes
- Right-click canvas >
Add Node > Data > DataInput - Right-click canvas >
Add Node > Layers > Dense - Connect nodes by dragging from output pins to input pins
Configuring Dense Layer
- Select the Dense node
- In Properties panel: Set Units=128, Activation=ReLU
Generate Code
Edit > Generate Code > PyTorch
Option 2: Using Python Scripting
Open the Console panel (View > Console) and try:
import cyxwiz as cyx
# Create a simple model
model = cyx.Sequential([
cyx.layers.Dense(128, activation='relu', input_shape=(784,)),
cyx.layers.Dropout(0.2),
cyx.layers.Dense(64, activation='relu'),
cyx.layers.Dense(10, activation='softmax')
])
# Print summary
model.summary()
# Compile
model.compile(
optimizer='adam',
loss='categorical_crossentropy',
metrics=['accuracy']
)
# Load sample data
(X_train, y_train), (X_test, y_test) = cyx.datasets.mnist.load_data()
# Train
history = model.fit(X_train, y_train,
epochs=5,
batch_size=32,
validation_split=0.2)
# Evaluate
loss, accuracy = model.evaluate(X_test, y_test)
print(f"Test accuracy: {accuracy:.4f}")Project Structure
After creating a project, you'll have:
MyProject/ ├── models/ # .cyxgraph files (node editor graphs) ├── scripts/ # Python scripts ├── data/ # Datasets ├── outputs/ │ ├── checkpoints/ # Model checkpoints │ └── logs/ # Training logs └── project.json # Project configuration
Loading Data
From File
# CSV
data = cyx.datasets.load_csv('data/train.csv')
# Images from folder
train_data = cyx.datasets.ImageFolder(
'data/images',
transform=cyx.transforms.Compose([
cyx.transforms.Resize(224),
cyx.transforms.ToTensor(),
cyx.transforms.Normalize(
[0.485, 0.456, 0.406],
[0.229, 0.224, 0.225]
)
])
)Built-in Datasets
# MNIST
(X_train, y_train), (X_test, y_test) = \
cyx.datasets.mnist.load_data()
# CIFAR-10
(X_train, y_train), (X_test, y_test) = \
cyx.datasets.cifar10.load_data()
# Fashion-MNIST
(X_train, y_train), (X_test, y_test) = \
cyx.datasets.fashion_mnist.load_data()Training a Model
# Configure training
history = model.fit(
X_train, y_train,
epochs=10,
batch_size=32,
validation_data=(X_val, y_val),
callbacks=[
cyx.callbacks.EarlyStopping(patience=3),
cyx.callbacks.ModelCheckpoint(
'best_model.h5',
save_best_only=True
),
cyx.callbacks.TensorBoard(log_dir='./logs')
]
)
# Plot training history
cyx.plot.training_history(history)Common Architectures
CNN for Image Classification
model = cyx.Sequential([
cyx.layers.Conv2D(32, (3, 3),
activation='relu',
input_shape=(28, 28, 1)),
cyx.layers.MaxPool2D((2, 2)),
cyx.layers.Conv2D(64, (3, 3),
activation='relu'),
cyx.layers.MaxPool2D((2, 2)),
cyx.layers.Conv2D(64, (3, 3),
activation='relu'),
cyx.layers.Flatten(),
cyx.layers.Dense(64, activation='relu'),
cyx.layers.Dense(10, activation='softmax')
])RNN for Sequence Data
model = cyx.Sequential([
cyx.layers.Embedding(
10000, 128,
input_length=100),
cyx.layers.LSTM(64,
return_sequences=True),
cyx.layers.LSTM(32),
cyx.layers.Dense(1,
activation='sigmoid')
])Saving and Loading
Models
# Save model
model.save('my_model.h5')
# Load model
model = cyx.load_model('my_model.h5')
# Save weights only
model.save_weights('weights.h5')
model.load_weights('weights.h5')Node Editor Graphs
- Save:
File > SaveorCtrl+S - Load:
File > OpenorCtrl+O - Export:
File > Export > PyTorch/TensorFlow/Keras
Next Steps
Explore Examples
Check the examples/ folder
Read Documentation
Full API reference
Join Community
Discord for help
Contribute
Open source project