You can use the aifeynman.run_aifeynman function to perform symbolic regression on a data file.
Parameters:
pathdir: Path to the directory containing the data file.filename: The name of the data file.BF_try_time: Time limit for each brute force call (default: 60).BF_ops_file_type: File containing the symbols for brute force (default: "14ops.txt").polyfit_deg: Maximum degree of the polynomial tried (default: 4).NN_epochs: Number of epochs for neural network training (default: 4000).vars_name: A list of strings representing the names of the variables in the data file (including the output variable), in the same order as they appear in the file.test_percentage: Percentage of input data to set aside for testing (default: 0).
Data Format:
The input file must be a text file where each column contains numerical values for each variable (dependent and independent). Columns can be separated by spaces, commas, or tabs.
Output:
Results are saved in a directory named results as solution_{filename}. Each row in the solution file represents a point on the Pareto frontier and contains:
- Mean logarithm (base 2) of the error (average error in bits).
- Cumulative logarithm (base 2) of the error.
- Complexity of the equation (in bits).
- Error of the equation on input data.
- The symbolic expression of the equation.
Note: If test_percentage > 0, the error on the test set is added as the first value in each row.
import aifeynman
# Download example data
aifeynman.get_demos("example_data")
# Run symbolic regression
aifeynman.run_aifeynman(
"./example_data/",
"example1.txt",
60,
"14ops.txt",
polyfit_deg=3,
NN_epochs=500
)