# Get paths to toy data file
data_file <- system.file(
"extdata", "sample_data_frame.csv", package = "maxent.ot"
)
tableaux_df <- read.csv(data_file)
# Fit weights to data with no biases
fit_model <- optimize_weights(tableaux_df)
# Predict probabilities for the same input with temperature = 2
pred_obj <- predict_probabilities(
tableaux_df, fit_model$weights, temperature = 2
)
# Run 5 monte carlo simulations
# based on predicted probabilities when temperature = 2,
# and learn weights for these 5 simulated data sets
monte_carlo_weights(pred_obj$predictions, 5)
# Save learned weights to a file
tmp_output <- tempfile()
monte_carlo_weights(pred_obj$predictions, 5, output_path=tmp_output)
Run the code above in your browser using DataLab