YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
๐ง Battleship MLP Hit Predictor
This model predicts the probability that a given move in Battleship will result in a hit, based on a flattened feature vector representing the current board state, ship layout constraints, and spatial heuristics. It is designed for use in agentic game logic and can be integrated into automated Battleship agents for move selection, pruning, and top-k targeting.
๐ฆ Model Details
- Architecture: Multi-Layer Perceptron (MLP)
- Framework: Keras (TensorFlow backend)
- Input: 1D vector of 16 engineered features (see below)
- Output: Float between 0.0 and 1.0 (probability of hit)
- Training Data: Flattened Battleship board states with labeled hit/miss outcomes
- Performance:
- AUC: 0.855
- Average Precision: 0.747
- F1 Score: 0.700
- Precision: 0.747
- Recall: 0.658
๐งฎ Input Features
The model expects a 1D vector of 16 features in the exact order listed in feature_list.txt. These features are extracted per candidate move using a flatten_record() function in your game logic. Example features include:
turn_numbercoverage_countnum_ships_that_can_fit_hereis_horizontal_hitis_vertical_hitcoverage_gradientis_adjacent_to_hitis_edge_cellis_diagonal_hitis_corner_cellis_center_cellis_legalis_impossiblecluster_sizeremaining_ship_countremaining_ship_max_length
All features must be normalized using the provided StandardScaler.
๐ Usage
1. Load the Model and Scaler
from tensorflow.keras.models import load_model
import joblib
import numpy as np
# Load model and scaler
model = load_model("battleship_mlp.h5")
scaler = joblib.load("battleship_scaler.pkl")
# Load feature order
with open("feature_list.txt") as f:
feature_order = f.read().splitlines()