Merge branch 'main' into alizaidi/exog_var_lookup
This commit is contained in:
Коммит
b7ceec5959
|
@ -0,0 +1,87 @@
|
|||
# https://docs.microsoft.com/en-us/bonsai/inkling/basics
|
||||
inkling "2.0"
|
||||
using Math
|
||||
using Goal
|
||||
|
||||
# The maximum angle (in radians) before fallover or failure
|
||||
const MaxPoleAngle = (12 * 2 * Math.Pi) / 360
|
||||
# Length of the cartpole track in meters
|
||||
const TrackLength = 2.0
|
||||
const MaxPosition = TrackLength / 2
|
||||
|
||||
|
||||
# These are all the values the sim produces
|
||||
type SimState {
|
||||
cart_position: number, # (m). 0 is the center of the track
|
||||
cart_velocity: number, # (m/s)
|
||||
pole_angle: number, # (rad). 0 is vertical.
|
||||
pole_angular_velocity: number, # (rad/s)
|
||||
# pole_center_position: number, # (m) -- x position of the center of the pole
|
||||
# pole_center_velocity: number, # (m/s) -- x velocity of the center of the pole
|
||||
# target_pole_position: number, # (m)
|
||||
|
||||
# physical params from the config are available too
|
||||
# cart_mass: number, # (kg)
|
||||
# pole_mass: number, # (kg)
|
||||
# pole_length: number, # (m)
|
||||
}
|
||||
|
||||
# This is a subset of the SimState that we'll make available to the brain
|
||||
# (these should all be values that will be available to a deployed brain)
|
||||
type ObservedState {
|
||||
cart_position: number, # (m). 0 is the center of the track
|
||||
cart_velocity: number, # (m/s)
|
||||
pole_angle: number, # (rad). 0 is vertical.
|
||||
pole_angular_velocity: number, # (rad/s)
|
||||
}
|
||||
|
||||
type Action {
|
||||
# Force to apply, up to the max force magnitude (1 Newton by default)
|
||||
command: number<-1..1>
|
||||
}
|
||||
|
||||
# Configuration variables for the simulator
|
||||
type SimConfig {
|
||||
cart_mass: number, # (kg), default 0.31
|
||||
pole_mass: number, # (kg), default 0.055
|
||||
pole_length: number, # (m), default 0.4
|
||||
initial_cart_position: number<-MaxPosition .. MaxPosition>, # (m), default 0 (center)
|
||||
initial_cart_velocity: number, # (m/s), default 0
|
||||
initial_pole_angle: number, # (rad), default 0
|
||||
initial_angular_velocity: number, # (rad/s), default 0
|
||||
# target_pole_position: number<-MaxPosition .. MaxPosition>, # (m), default 0
|
||||
}
|
||||
|
||||
graph (input: ObservedState): Action {
|
||||
concept BalancePole(input): Action {
|
||||
curriculum {
|
||||
source simulator (Action: Action, Config: SimConfig): SimState {
|
||||
package "ddm-cartpole-08-31"
|
||||
}
|
||||
training {
|
||||
EpisodeIterationLimit: 200,
|
||||
}
|
||||
goal (SimState: SimState) {
|
||||
avoid FallOver:
|
||||
Math.Abs(SimState.pole_angle) in Goal.RangeAbove(MaxPoleAngle)
|
||||
avoid OutOfRange:
|
||||
Math.Abs(SimState.cart_position) in Goal.RangeAbove(MaxPosition)
|
||||
}
|
||||
|
||||
lesson initial_positions {
|
||||
scenario {
|
||||
initial_cart_position: number<-0.1..0.1>
|
||||
}
|
||||
}
|
||||
lesson all_positions {
|
||||
scenario {
|
||||
initial_cart_position: number<-MaxPosition .. MaxPosition>
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Special string to hook up the simulator visualizer
|
||||
# in the web interface.
|
||||
const SimulatorVisualizer = "/cartpoleviz/"
|
|
@ -3,9 +3,9 @@ hyperopt==0.2.5
|
|||
lightgbm==3.1.0
|
||||
matplotlib==3.4.1
|
||||
microsoft-bonsai-api==0.1.3
|
||||
mlflow==1.15.0
|
||||
mlflow==1.23.1
|
||||
natsort==7.1.0
|
||||
numpy==1.19.5
|
||||
numpy==1.22.0
|
||||
optuna==2.6.0
|
||||
pandas==1.2.4
|
||||
python-dotenv==0.13.0
|
||||
|
|
|
@ -24,4 +24,5 @@ scikit-learn==1.1.3
|
|||
# skorch==0.12.1
|
||||
# tensorboard==2.11.0
|
||||
# tune-sklearn==0.4.5
|
||||
xgboost==1.7.1
|
||||
xgboost==1.7.1
|
||||
|
||||
|
|
|
@ -84,7 +84,9 @@ class PyTorchModel(BaseModel):
|
|||
else:
|
||||
use_cuda = torch.cuda.is_available()
|
||||
self.device = torch.device("cuda" if use_cuda else "cpu")
|
||||
|
||||
|
||||
# For more information about this class configs, you can see the following link:
|
||||
# https://skorch.readthedocs.io/en/stable/regressor.html
|
||||
self.model = NeuralNetRegressor(
|
||||
network,
|
||||
device=self.device,
|
||||
|
|
Загрузка…
Ссылка в новой задаче