Changelog¶
All notable changes to this project will be documented in this file.
0.10.3¶
gpboostis a new model, which wraps GPBoost (now in theboostingextra): gradient boosting whose trees are fitted together with a random intercept for each level of "groups" (the dataset's first group by default) and, if "coordinates" names columns, a Gaussian process over them. It regresses with the "gaussian" likelihood (or another, such as "poisson") and classifies two classes with "bernoulli_logit" (or "bernoulli_probit"). Rows of groups that it has not seen are predicted with their random effects at zero, and the variances of the random effects are stored intablesas "gpboost_random_effects". TheGaussianProcessBoostingadapter gives GPBoost the scikit-learn interface, sogpboostcan be searched and criticized like any model: given only the features (as permutation importance gives it), it predicts from its trees alone.gpboost_classificationandgpboost_regressionare new pipelines, which split by group, leave missing values for GPBoost, and search its learning rate and tree size.bambiis a new model, which wraps Bambi (in the newbayesianextra, on Python 3.12 and later): a Bayesian regression that PyMC samples, by default of the label on every feature with a random intercept for each level of "groups" (the dataset's first group), or of any "formula" in Bambi's syntax. It classifies two classes with the "bernoulli" family and regresses with "gaussian" (or another "family"). The posterior mean, standard deviation, and 95% credible interval of each coefficient are stored intablesas "bambi_coefficients", and those of the standard deviations of the random effects as "bambi_random_effects". TheBayesianMixedModeladapter gives it the scikit-learn interface, and keeps its posterior (not Bambi's model, which cannot be pickled).pymcis a new model, which fits Bayesian additive regression trees (BART) with PyMC and pymc-bart (also in thebayesianextra): "m" small trees (50 by default) whose posterior is sampled, with the "bernoulli" likelihood for two classes and "normal" (or "poisson") for numbers. Its importances are the share of its trees' splits on each feature. TheBayesianAdditiveTreesadapter keeps the sampled trees, so the model can be pickled, and predicts the mean of every posterior draw.bambi_classification,bambi_regression(both split by group),pymc_classification, andpymc_regressionare new pipelines.- Classifiers are now compared by the Matthews correlation coefficient
wherever amos chooses how: the scorer of a model's search (which was the
model's own score, usually accuracy), the pipelines' searches and the
classificationpipeline's criterion (which were balanced accuracy),auto_model's default metric (balanced accuracy), and the default scorer of the model-based selectors, permutation importance, and the learning and validation curves (accuracy). A high MCC needs a high sensitivity, specificity, precision, and negative predictive value (Chicco and Jurman, BioData Mining 16, 4, 2023, https://doi.org/10.1186/s13040-023-00322-4).utilities.default_scorerreturns the scorer for a task, and the advanced guide explains the choice. The scorecard of a classifier also reportsmatthewsby default, afterbalanced_accuracy. - Plots keep their SciencePlots styles ("science, nature" by default) after Bambi or PyMC is imported. Importing them imports arviz_plots, which reloads matplotlib's library of styles and so dropped SciencePlots' styles: amos now registers them again when they are missing.
- The README's scorecard and importance plot are drawn again, with the
matthewscolumn and the drops in MCC that permutation importance now measures.
0.10.2¶
- Savers are a new genre of the wrangler (
amos.savers, with the base classamos.Saver), which save the dataset at their point in a workflow and pass it on unchanged, so that a later run can go on from there.save_datasaves the wholeDataset(with its split, fitted tools, model, tables, figures, and history) in a joblib file, and its data as a table (parquet by default, or any format of the clerk set by "table_format", or none). The files go in the clerk's interim folder, named for the project and the saver (such as "cancer_save_data"), unless "folder" or "file_name" says otherwise. In a branch of an experiment, the label of the branch is added to the file name, so every branch is saved, in parallel runs too (the branch's label is part ofbase.WorkflowState). - A file that holds a saved
Datasetcan be passed as a project'sitem, loaded by a loader (such asload_file), or given toDataset.create, and the dataset goes on from where it was saved, history and all.
0.10.1¶
- The README's table of techniques lists the pretests (in the analyst) and
the audits (in the critic), and its list of extras notes that
check_stationarityneeds thestatisticsextra. load_chunksis a new loader, andamos.loaders.read_chunksthe function behind it, for CSV files too large to load at once (such as bulk files of court records of many gigabytes, compressed with bzip2). They read a block at a time with pyarrow on every core, decompress bzip2 on every core with indexed_bzip2 (and gzip, xz, and Zstandard as they read), and keep only the chosencolumnsand the rows whose values are inkeepor that matchwhere, with options for the file's dialect (such asescape_char),block_size, and progress in the log. A URL is read as it arrives or downloaded first.downloadcan find its file by the words of a link on a web page (link), check that a downloaded zip archive has a file that matches a pattern before saving it (required_member), resume a download that stopped (resume), and take asession(anything with agetmethod like arequests.Session). The tools behind it are public inamos.loaders:download_file,download_linked_file,page_links,find_links, andopen_session.- Breaking: downloads use
requests, so a failed one raisesrequests.HTTPErrorrather thanurllib.error.HTTPError. html_to_textis a new munger, andamos.mungers.html_to_texta function, that converts HTML or XML to plain text, with the tags and classes whose text is left out (skipped_tagsandskipped_classes) and the tags that start lines (block_tags) as parameters.- pyarrow, indexed-bzip2, and requests are now required, so the
polarsextra installs only Polars. - The docstrings of the new modules follow pydoclint's rules, so the checks of continuous integration pass.
- Continuous integration uploads test coverage to Codecov, for the README's
coverage badge. The tests draw figures with matplotlib's Agg backend, so
they do not need Tk, and the guide's example of
load_chunksgives the same output on Windows.
0.10.0¶
- Techniques name what they assume about the data in
assumptionsand what they need from it inneeds(such asLinear.assumptions = ("linearity", "normal_errors", ...)). Each name is a subclass ofamos.Assumptionoramos.Need(in the newamos.conditions,amos.assumptions, andamos.needsmodules), so a user can add their own. Models, imputers, samplers, and inferers have them. - Breaking:
amos.models.ModelTraitsandModel.traitsare gone. What a model assumes and needs are itsassumptionsandneeds, and the rest are attributes of the model:package,complexity,min_rows,max_rows, andmax_features.Model.countsis thecount_labelneed. - Pretests are a new genre of the analyst (
amos.pretests), which check assumptions and needs before a technique is applied:check_normality,check_multicollinearity,check_linearity(RESET, or Box-Tidwell for two classes),check_scales,check_dispersion,check_features,check_label,check_sample_size, andcheck_assumptions, which runs every pretest that the workflow's techniques need. - Audits are a new genre of the critic (
amos.audits), which check a fitted model's assumptions from its errors:audit_residuals(normal errors),audit_errors(constant variance, by Breusch-Pagan),audit_independence(Breusch-Godfrey and Durbin-Watson in the dataset's order, and the intraclass correlation within its groups), andaudit_assumptions, which runs every audit that the model needs. - More pretests test the assumptions of imputers, ordinal models, and
inferers:
check_missingness(missing completely at random, by Little's test),check_proportional_odds(Brant's test),check_overlap(the propensity scores of a treatment),check_instrument(the first-stage F statistic of an instrument),check_parallel_trends(the trends before a treatment),check_continuity(a density test at a regression discontinuity's cutoff), andcheck_stationarity(the augmented Dickey-Fuller and KPSS tests).audit_proportional_hazardsapplies Grambsch and Therneau's test to a fittedcoxmodel. The pretests of an inferer read its parameters (such as its "treatment"), and a pretest step passes its own parameters to them. Some of these assumptions can only be tested in part (such as the relevance, but not the exclusion, of an instrument), and three cannot be tested at all (unconfoundedness,causal_sufficiency, andmissing_at_random). - amos runs the pretests of a technique just before it is applied, records
them in the dataset's "assumptions" table and
history, and does what the new "assumption_violations" setting of the "general" section says when one fails: "warn" (the default), "raise" anamos.AssumptionError, "ignore" it, or "skip" the branch of an experiment. A hard need (such as no missing values) always raises, or leaves the branch out. - An experiment's comparison table has a "violations" column when a branch
did not meet an assumption, and lists the branches it left out. The
Findingsreport ends with the assumptions that were not met. auto_evaluatorappliesaudit_assumptionsto a regression whose model makes assumptions that only its errors can test (such aslinearandols), and the pipelines of least squares and statistical models include it. AnAssumptionErrorfrom an evaluator is raised, not left out.auto_modelscreens models with the same pretests, so it now also rules out models whose label is not linear in the features, and statistical models (such aslogit_sm) with collinear features.- The "general" section can set an
order: the column that puts the rows in order (such as a date), which is not a feature. - A new page of the documentation, Assumptions, lists every assumption and need (with the tests that decide each, or whether it cannot be tested), and those of each technique.
0.9.0¶
- The source follows the stages of a project.
src/amoshas a folder for each stage (wrangler,explorer,analyst,critic, andartist), each with a package for each of its steps (such asamos/wrangler/cleaners), and acorefolder for what every stage shares (base,workers,pipelines,interface,reports,clerks,metrics,auto,options, andutilities). Each step keeps its base class in_base.pyand its techniques in private modules, grouped by theme or by the package they wrap. Every step and core module is still imported fromamositself (such asamos.cleaners.CleanBooleansoramos.base.Dataset), and techniques are still named by those paths, so settings, records, and pickles are unchanged. - Breaking: the
transformersmodule is split into a step for each of its genres:amos.imputers,amos.scalers,amos.encoders,amos.mixers, andamos.reducers(for example,amos.scalers.Standardrather thanamos.transformers.Standard).amos.transformerskeeps only the base class,Transformer, andColumnWise. Names in settings (such asstandard) are unchanged. - The API reference lists the core modules, then the steps of each stage in
the order of a project. Metrics and choosers are documented in
amos.core.metricsandamos.core.auto. - The tests are in a folder for each stage, like the source, and the tests of the transformers are split by step.
-
Two of the new private modules no longer end with a blank line, which failed the pre-commit check in CI.
-
Parsers are a new genre of the wrangler (
amos.Parser), for techniques that find information in the text of a dataset and make columns of it. Each kind of search for a regular expression is a parser of its own, which settings can name with apattern(or a list of them), thecolumnto search, thenameof the column to make, avalue, andflags:parse_flags,parse_counts,parse_category,parse_categories,parse_match,parse_matches,parse_split(into any number of columns),parse_names,parse_fields(a column for each labeled section, such as "AUTHORS:"), andparse_replace. They are pattern parsers (amos.PatternParser). A pattern with named groups (such as "(?P\d{4})") makes a column for each group in parse_matchandparse_matches. For the parsers that write a value,patterncan map patterns to their values, andparse_categorytakes adefaultfor text that matches none.column = "*"searches every column of text, andseparatorsets what separates several values in a cell (also a column of rule files). parse_all(amos.parsers.ParseAll) applies a rulebook: an ordered list of rules from CSV files (ordicts in settings), each of which is one of those searches, named by its kind (flags,counts,category,categories,match,matches,split,names,fields, orreplace). Each rule searches every row at once, and the columns that a rulebook makes are added all at once. A subclass ofParseAllthat sets itsrulesis a named rulebook: a technique of its own (such asparse_federal) and a name that settings and other rulebooks can use (rules = federal). CSV files in an older layout of rules are read as they are.- Every pattern parser is a kind of rule, named for its class without
"Parse" (
ParseInitialsis "initials"), so subclassingPatternParseris all it takes for rulebooks to name a parser of your own in their "kind" column. Itsrule_aliasesgive the kind other names. - Breaking:
amos.register_value_mapis gone. A subclass ofMapValuessets the map or function of each column in itsvalue_maps, and settings name the subclass (such asmap_race_codes). Without "columns", it maps every column ofvalue_mapsthat is in the data. - The mungers that searched text for patterns (
flag_patterns,count_patterns,map_patterns,extract_pattern,extract_all,split_text, andreplace_text) are gone: use the parsers instead. - The regular-expression helpers that mungers and parsers share are in a
private module,
amos.wrangler._patterns, and mungers and parsers share the check that they keep the rows and every column. parse_numbers,parse_dates, andparse_booleansare now cleaners namedclean_numbers,clean_dates, andclean_booleans(amos.cleaners.CleanNumbers,CleanDates, andCleanBooleans). They work as before, but settings must use the new names, and the old names and classes inamos.mungersare gone. Mungers now hold only techniques that change or add to the data already in a dataset in other ways.downloadalso downloads OpenML datasets: a source that is not a URL is the name (such as "credit-g") or id (such as 31) of one. Theopenmlloader (amos.loaders.Openml) is gone, so settings must usedownload.load_files(amos.loaders.LoadFiles) loads a batch of files (a folder, a pattern of paths, or a list of paths) into one table, reading them at the same time in threads. Files of tables add their rows, and files of text (such as ".txt" files) add a row each, with the text in a "text" column, so a batch of documents can be worked on all at once. Each row names its file in a "file" column.- Loaders read plain-text files in UTF-8 (unless "encoding" names another), rather than in the computer's default encoding, which garbled accented letters on Windows.
- A cleaner's entry in
historyhas "changed", the columns whose values or type it changed, when it keeps the rows and changes at least one column. - The API reference no longer shows the "Contents:" lists of module
docstrings (a griffe extension,
docs/scripts/hide_contents.py, removes them when the documentation is built). Each module's page starts with its path and a table of its classes instead, and each heading and table of contents entry is labeled with its kind. - Clearer docstrings: the summary of each technique says what it does (such as "Fits a random forest." or "Plots the label against the model's predictions."), genres are described as base classes, and public docstrings no longer point to private names. The technique catalog is regenerated from the new summaries.
- The examples in the docstrings and the guides use a variety of subjects (such as customers, patients, schools, stores, and research papers) rather than mostly courts and judges, and the parsers describe the older layout of rule files in general terms.
0.8.1¶
- A test that runs for more than 10 minutes now fails (with pytest-timeout, a new development dependency) and prints the stack of every thread, and a CI test job stops after 30 minutes. Some macOS jobs had deadlocked near the end of the tests and held their runner for GitHub's limit of 6 hours.
- CI's macOS jobs make every package load Homebrew's OpenMP, by linking the copies that scikit-learn and diptest bring to it. With scikit-learn's copy and Homebrew's (which lightgbm and xgboost use) in one test process, lightgbm sometimes deadlocked or crashed. The new timeout named the test.
amosrequires chrisjen 0.5.0 and bobbie 0.5.0, and calls their public helpers (such aschrisjen.utilities.listify_namesandbobbie.options.file_type) directly. The wrappers of them inamos.utilities, which fell back to their private names in earlier versions, are gone.- Fixed the deployment of the documentation and the creation of releases, which 0.8.0 broke by giving every job of the CI workflow read-only permissions. The workflow is still read-only by default, and only the jobs that deploy the documentation and create releases can write.
- A scorecard (and a validator's default metrics) leaves out, with a logged
warning, any default metric whose optional package is not installed, so
Project.exportno longer fails at the scorecard after saving every table and figure when fairlearn is missing. A metric named in "metrics" still raises anImportErrorif it cannot be imported. - A scorecard adds the fairness metrics by default only if the dataset's
first
groupscolumn has at mostScorecard.fairness_limit(20) distinct values, such as race or court. Groups that keep a case's rows together (with thousands of values) are no longer compared. Name the fairness metrics in "metrics" to compare more groups.
0.8.0¶
- Fixed the defaults that
optionsdocuments as changeable: the test size of splitters, the timeout ofdownload, the threshold ofauto_categorize, the style and colors of plots, and the data and studies folders of aClerkare now read fromoptionswhen they are used, so settingamos.options._DEFAULT_TEST_SIZE(for example) takes effect. Before, each was fixed whenamoswas imported. Project.applyno longer changes aDatasetthat it is given: its label, task, seed, groups, and switches are filled in on a copy.Dataset.model_nameis the name of the technique that fitted the dataset's model. Each model marks its entry inhistorywith "role" ("model"), which the choosers, the model-specific techniques, and the regression table use to find it (each found it its own way before).Datasethas the publictrain_rows,test_rows, andreal_train_rows(the training rows that a sampler did not make up) andrequire_label(), in place of the private_train_rows(),_test_rows(), and_require_label().- Breaking: an
Infererwritesinfer, which returns anamos.Inference(the table of estimates, the fitted estimator, and any other tables and details to record), andInferer.applyadds it to the dataset as anEvaluatoradds its table. A custom inferer that wroteapplyshould writeinferinstead. - What each model needs from the data and assumes about it is its
traits(anamos.models.ModelTraits), whichauto_modelreads, rather than a table inauto. A model's tasks are the keys of itstools. - Each chooser names the steps that "auto" stands in for it in
(
step_names), and "auto" finds the choosers by theirchooses, so a package built onamoscan add one. Scorecard.metric_names(a class method) returns the metrics of a scorecard, which validators use by default.- Warnings from
amoshave their own category,amos.AmosWarning(aUserWarning), so they can be filtered apart from those of other packages. - An
Experimentand a validator taken_jobs, which applies that many paths (or fits that many folds) at once, each in its own process. It is 1 by default, as before.joblib(which scikit-learn requires) is now a dependency of its own. - The extras named in the message for a missing package, and the packages
whose versions
Project.exportrecords, are read fromamos's own requirements, so they no longer drift frompyproject.toml(camina, nagata, networkx, optuna-integration, and pyarrow were missing from the record).options._RECORDED_PACKAGESis gone, andoptions._EXTRASonly lists the packages that another package's extra installs. plots,evaluators,inferers, andmodelsare packages of smaller private modules (such asplots._shap). Every name is imported from the same place as before (such asamos.plots.RocCurve).amosuses the helpers thatchrisjenandbobbienow make public (throughamos.utilities, which falls back to their private names with the released versions), rather than their private names.- Faster:
accepted_parametersbuilds a default instance of each class once (rather than at each fit), and the bookkeeping of a sampler's rows is vectorized. Shared helpers replace copies in several modules, every function's docstring has all of its sections, and CI runs the tests in parallel with read-only permissions.
0.7.2¶
- Explorers that test the distribution of each column (every column, unless
"columns" names some), with the usual test of each at a significance
level of "alpha" (0.05 by default):
is_normal(Shapiro-Wilk, or D'Agostino and Pearson's test beyond 5,000 values),is_log_normal(the same test of the logarithms),is_left_skewedandis_right_skewed(D'Agostino's test of skew),is_poissonandis_binomial(chi-square),is_uniform(chi-square for whole numbers, Kolmogorov-Smirnov otherwise),is_exponential(Anderson-Darling),is_studentandis_beta(Kolmogorov-Smirnov against the fit by maximum likelihood),is_bernoulli(every value is 0 or 1), andis_bimodal(Hartigan's dip test, with tied whole numbers spread evenly first). Each makes a table with a boolean for each column, which is false for a column that is not numeric or boolean or has fewer than 8 values. A binomial distribution's number of trials is "trials", or by default the number that makes the values most likely. distributionsnames the distribution of each column: the one with the lowest AIC that passes its test (or "none"), the "closest" one by AIC whether or not it passes, and the direction of the "skew". Continuous distributions are compared with discrete ones on whole numbers by the probability within half of each value, and a bimodal distribution (a mixture of two normal distributions) is considered only when the dip test finds more than one peak.- The
distribution_fitsplot draws each numeric column's histogram (or bars, for whole numbers) with the counts that a fitted distribution expects, which the new explorers draw withvisualize. describershas the functions that they use:fits_distribution,fit_distribution,best_distribution, andis_skewed. Student's t distribution is fitted with the gradient of its likelihood, which takes about a second for a million values, rather than SciPy's ownfit.- The "statistics" extra installs diptest, for
is_bimodal(distributionsleaves out a bimodal distribution, with a warning, if it is not installed). SciPy 1.17 or later is required, for the p-values of the Anderson-Darling test. - A "Pipeline Chart" page in the user guide, after the technique catalog,
shows the steps of every named pipeline side by side: the techniques of
each step of the analyst, critic, and artist of the pipelines for studies,
and the steps, search, validator, and extra plots of the pipeline of each
model, grouped by the model's family (with buttons that show the
pipelines of one task).
docs/scripts/pipeline_chart.pydraws it fromPIPELINESwhen the documentation is built, so it is never out of date.
0.7.1¶
- The statsmodels models need far less memory and time for millions of
rows.
Statsmodelmakes its features floats in one array (by columns), which statsmodels shares rather than copies, instead of copying every row as it makes them floats, adds the constant, and leaves out collinear features. It finds the collinear features from one QR decomposition made a block of rows at a time, instead of a singular value decomposition of every row for each feature (the same features, by the same tolerance), and the discrete models (such aslogit_sm,mnlogit, andpoisson) no longer check the rank of the features again. A multinomial logit of a million rows and 76 features is fitted in about a quarter of the time, with about two thirds of the memory. A feature named "const" now raises an error in a model with a constant, rather than pandas' error. - Every model has a named pipeline of its own for each task that it can do,
such as
random_forest_classification,random_forest_regression,ols_regression, orquantile_inference(fixesthas the panel pipelines). Each prepares the data as its model needs: features are scaled only for models that need it (standardized for penalized linear models, support vector machines, nearest neighbors, and neural networks, and made more normal for naive Bayes), missing values are left for the models that handle them, categories are encoded against a reference level for models with an intercept and no penalty, rare classes are weighted by the models that can weigh them and resampled for the others (but not for models for inference), models that overfit without tuning search for their best settings, nearest neighbors keep the 20 features most related to the label, and a neural network stops early. The critic and artist choose among the evaluators and plots that explain the model's family best, such as SHAP values for trees, the diagnostics of a model's assumptions for models for inference, a learning curve for a neural network, and survival curves for a Cox model. The technique catalog lists every pipeline with its steps. Pipelinehasgrouped, for a model that needs the dataset's groups (gee,mixedlm, andbinomial_bayes_mixedglm), andrequiredandshared_with, for parameters that the settings must give (such as the "event" ofcox, whichsurvival_curvesis also given).Pipeline.modelsreturns the models that a pipeline fits or chooses among.- A model's parameters section (such as "xgboost_parameters") can name the
"plots", "evaluators", and "inferers" to use when it is the dataset's
model, such as the winner of a contest. In a project, they replace the
techniques of those genres (and
auto_plot,auto_evaluator, or anautothat chooses them) that the workflow applies after the model is fitted, so the critic and artist can suit whichever model won. A model that names none keeps the workflow's. Each replaced technique records the "model" and the techniques it was "replaced_by" inhistory, and the settings are not passed to the model as parameters. The newProject.model_specific_techniquesholds them, built bydraft, andbase.using_model_specific_techniquesapplies them. mnlogittakes "reference", the class that its coefficients compare the other classes with (the first class, sorted, by default). A class matches if it equals "reference" or has the same text, so a reference read from a settings file matches a class that is a number.Statsmodel.levels_now puts the reference first, and its table of coefficients has a row for each feature and class other than the reference.
0.7.0¶
- A project whose workflow has an
experimentorcontestexports "{project}_replication.json" (such as "cancer_replication.json"), the settings of only the winning path, so another researcher can replicate the winner without trying every combination. The newProject.winning_settingsreturns them as anIdea, and the newProject.export_replicationsaves them alone, with afolder,file_name, andfile_format.bobbiewrites the file, in json (the default), ini, toml, yaml, or py: set "replication_format" in the "files" section, or passreplication_formattoexport. Each contest becomes aflowin which each step keeps only its winning technique, the parameters of the techniques that lost are dropped, a searched model gets the values its search chose (without "search", "cv", "n_iter", and "scoring"), and "pipeline" settings are dropped, since the pipeline is already filled in. - Requires
bobbie0.4.0 or later, which writes settings files. The newsettingsextra (part ofall) installs its writers for toml and yaml files. "environment.json" records the version ofbobbie. - Every explorer (describer) and critic (evaluator or inferer) takes
visualize(false by default), which draws its table as a figure in the style of every plot and stores it in the dataset'sfiguresunder the technique's name, with "figure" in its entry inhistory. The new "visualize_explorers" and "visualize_critics" settings of the "general" section (and theDatasetfields andDataset.createarguments of the same names) replace thevisualizeof every technique of their stage when they are set: true draws every figure and false draws none. They are not set by default, which leaves it to each technique (so nothing is drawn). A figure that cannot be drawn logs a warning and records "figure_error" rather than losing the table. - New plots that draw those tables (and can be used by the artist):
association_rules_plot,bias_variance_plot,causal_graph(tigramite's graph of the links ofpcmci,pcmci_plus, andlpcmci),classification_report_heatmap,distribution_plots,estimates_plot(every model of aregression_table),frequency_plots,loadings_heatmap,missing_bars,scorecard_plot,scree_plot, andweights_plot. Each takes a "source" table and makes it if it is missing (exceptcausal_graph). correlation_heatmap,confusion_heatmap,fairness_plot, andprediction_intervalstake a "source" table to draw,box_plotstakessplit = falseto draw one box for each column, and the newPlot.make_figurereturns a plot's figure without adding it to the dataset (Plot.applyuses it).- The axes of SHAP plots write numbers in full rather than in scientific
notation, unless they are a million or more (see the new
options._SCIENTIFIC_LIMIT). Small SHAP values were ticks of whole numbers beside a power of 10 (such as "1, 2, 3" and "1e-7"), and are now ticks such as "0.0000001", without a power of 10 or a number to add beside the axis. causal_graphlends its figure tomatplotlib.pyplotwhile tigramite draws, as the plots of shap, mlxtend, and dtreeviz do, since tigramite draws its colorbars withpyplot.colorbar, which would otherwise leave an empty figure open in pyplot.
0.6.4¶
- A
regression_tableof an experiment with only one branch left (such as one that conserves memory, which keeps only the winner's dataset) names its column by the branch's model, not by its last step, which was the validator when the experiment had one.
0.6.3¶
- A technique that does not suit the model no longer ends the workflow of a
Projector anExperiment. It raises the newamos.IncompatibleTechniqueError(aValueError), so in a workflow the technique is skipped: a warning is logged, and its entry inhistory(and "history.json") has "skipped" and the "reason". AnExperimentalso lists what each path skipped inExperiment.skippedand in the "skipped_techniques" of its entry inhistory, since the datasets of other paths may not be kept. Choosers mark a skipped technique as not chosen. This coverscoefficient_plotandsearch_plotwithout a table (unless "source" names one),influence_plot,qq_plotof a classifier,decision_regionsof a regression,shape_functions,tree_plot, thedtreevizplots, the curves of a model without probabilities, the plots that need a scikit-learn model,bias_variance,explain_weights, andfeature_importance. Callingapplyon one of these directly still raises the error, which is aValueErroreven for the plots andbias_variancethat raised aTypeErrorfor a model that is not from scikit-learn. Code of your own can skip them in the same way withamos.base.skipping_incompatible_techniques. - Validators free each fold's fitted model before fitting the next, which
lowers the peak memory of cross-validating a large
fixestmodel by about one fitted model. Validators that pool their folds (such asleave_one_row_out) free it without forcing a garbage collection, which would be slow for so many folds. The scores do not change.
0.6.2¶
- Requires
bobbie0.3.3 or later, so an ini list can go on over several lines and the rest of a line after a#with spaces on both sides is a comment. - The label can be a column that the wrangler makes (such as with
derive_columns). Until then it is pending:Datasetkeeps its name rather than raising aKeyError, infers the task once the column is made, and raises an error if the label is used before. The newDataset.has_labelsays whether the label is a column yet. - Added
set_kinds, a munger that gives each column a kind ("dummy", "categorical", or "numerical") in the smallest type that holds it exactly (int8for dummies, the "category" type, and the smallest integer or float type for numbers), and infers the kinds of the columns it is not given. A dummy with missing values raises an error, and a classified label of booleans becomes a dummy. The kinds are kept in the newDataset.kinds, so a dummy is one of the dataset'sbooleans. rename_columns,filter_rows, andderive_columnstake settings named for columns, so they need no mappings in an ini file (state = state_abbreviation,state = not in ['GU', 'PR'], andminor = victim_age < 18). A condition offilter_rowscan start with a comparison, "not" and a value, or be a value or list.- Words that are not columns in the conditions of
filter_rowsand the expressions ofderive_columnsare values, so text needs no quotes (offender_race == B). A word that is both a column and a value of the column it is compared to raises an error. map_valueswithout "values" uses the map or function registered for each of its columns with the newamos.register_value_map.frequenciestakescolumns = all, which counts the categorical and boolean features, including the dummies ofset_kinds.interactionstakes formulas, such asrace = offender_race * victim_race. Categorical columns make one categorical column of their combinations (such as "white_offender_black_victim"), numbers make their product, and both make the product for each combination.- Groups of features can be the parameters of
feature_group(such asraw = a, bin "feature_group_parameters"). A step that namesfeature_groupthen names each group in its place, so an experiment compares them as branches, andalways_usein those parameters is kept by each group. - Features listed as
always_usein the "feature_groups" section of the settings are kept by every feature group (including a numberedfeature_groupwith its own "columns"), so they are in every group's path.always_useis not a technique of its own, and other selectors are not affected. - Metrics are no longer steps of a workflow.
Metricis now achrisjen.Criteriarather than anOperation, so it has noapplyand is stored under "criteria" in the library instead of with the techniques. Name a metric as a worker'scriterion, or in themetricsof ascorecardor validator; listing one among a worker's techniques raises aTypeErrorthat says so. In Python, callmeasurefor a score (it now uses the metric's ownparameters, which a keyword argument overrides).
0.6.1¶
- Added selectors, a new genre of analyst techniques that keep some of the
features and remove the rest (the new
selectorsmodule andSelectorclass), usually in a step of their own such as "select".k_best,select_percentile,variance_threshold,sequential_selection, andexhaustive_selectionmoved there from the reducers (their names in settings are unchanged, but their classes are now inamos.selectors, and theReducergenre has onlypca_reduce). New selectors wrap the rest of scikit-learn'sfeature_selectionmodule:select_fpr,select_fdr,select_fwe,generic_univariate,select_from_model,recursive_elimination,recursive_elimination_cv(which adds a "{name}_search" table of the score of each number of features), andsequential_selection_sk(which needs no optional package). The selectors that fit a model take the name of a model in the library as their "estimator" (such asrandom_forest, which is built for the task), and a selector that would keep no features raises an error. - Added feature groups: each group named in a new "feature_groups" section of
the settings (such as
demographics = age, sex, race) is a technique that keeps only its features, so an experiment can compare groups of features that you chose (select_techniques = demographics, case_facts). A listed column that has been encoded keeps the columns made from it (so "court" keeps "court_federal" and "court_state" afterone_hot). Thefeature_grouptechnique does the same with the features passed as its "columns". - The scorecard of a dataset that did not come from an experiment lists its
selectors as a step, including feature groups that are only in a
project's own library (a technique that is not in
chrisjen.libraryis listed under the "genre" in its history entry, if it has one). - Requires chrisjen 0.4.2, camina 0.2.4, and nagata 0.2.1 or later, and the
lock file uses the latest chrisjen, camina, nagata, bobbie, bunches,
holden, miller, and wonka. All of them ship the
py.typedmarker, so themypyoverride that followed their untyped imports is gone. - The parameters of techniques (
base.GenericDict) havestrkeys, as chrisjen now types them, and the casts ofLoader.buildandMerger.buildare gone, since chrisjen'sbuildreturns the class it is called on. - The axes of plots start at 0 (or end at 0, for negative numbers), unless
they show something with no natural zero (the values of the features, the
label of a regression or the model's predictions of it, or the parameters
of a model in
search_plotandvalidation_curve), or are axes of names, dates, a logarithmic scale, or a heatmap. The new "start_at_zero" parameter of every plot ("x", "y", "xy", or "") picks the axes (anything else raises aValueError). - The panels of a plot that measure the same thing share their ranges: the
counts of
histogramsandcount_plots, the scores ofsearch_plot, and the contributions ofshape_functions. In apair_plot, each feature has one range, on the x axes of its column and the y axes of its row. - The lock file uses category-encoders 2.11.2, coverage 7.17.0, fairlearn 0.15.0, great-tables 1.1.0, mapie 1.6.0, markdown-exec 1.12.6, mkdocs-coverage 2.0.1, mkdocs-material 9.8.0, pandas 3.1.0, polars 2.1.0, pre-commit 4.7.0, pyarrow 26.0.0, ruff 0.17.3, statsmodels 0.15.0, and uv 0.13.6, and the workflows use astral-sh/setup-uv 10.3.2.
0.6.0¶
- Added
Clerk(in the newclerksmodule), anagata.FileManagerthat is now theclerkof everyProjectand loader. It keeps data and results outside a project's code, in the "workspace" that holds the "code" folder: data in its "data" folder (or in a subfolder of it named by the new "data_subfolder" setting of the "files" section, such as "crime/nibrs"), and each run's results in its "studies" folder. The workspace is the folder that holds the nearest "code" folder above the current folder (or the current folder, if there is none), unless theAMOS_WORKSPACEenvironment variable oroptions._DEFAULT_ROOTnames another. Before, a project kept its files in the current folder, so a project that relied on that should set "root_folder", "input_folder", or "output_folder" in its "files" section.
0.5.2¶
- Added named pipelines (the new
pipelinesmodule andPipelineclass).pipeline = classificationin the "general" section (or the project's section) fills in the settings of the analyst, critic, and artist, so a study can be a label, a seed, and a pipeline. The pipelines areclassification,regression, andcount_regression, which compare models in an experiment, andclassification_inference,regression_inference,count_inference,panel_classification, andpanel_regression, which fit one model for its coefficients (without scaling or resampling, and with each category encoded against a reference level). Settings that you write win over the pipeline's, a worker's own section can name a pipeline for that worker, the pipeline sets "task" if it is not set, and the filled-in settings are inProject.ideaand the exported "settings.json". Add aPipelinetopipelines.PIPELINESto name your own. - Added three choosers, which the pipelines use and "auto" now resolves to
in steps named "impute", "encode", and "evaluate" (and in a worker named
"critic"):
auto_imputerfills missing values (withiterative_imputewhen many numeric values are missing,median_imputeotherwise, andmode_imputefor categories);auto_encoderencodes each categorical feature by its number of levels (one_hotfor 15 or fewer,targetfor more with a label of two classes or a regressed one,countfor a label of more classes,tfidffor free text, anddate_partsfor dates); andauto_evaluatorapplies the evaluators that suit the task and the model. auto_modelknows the needs ofols,logit_sm,probit, andmnlogit(such as the number of classes), which it considers when they are named in "choices".- Fixed
smote_tomekandsmote_ennmarking every training row as synthetic, because they remove some of the original rows after adding rows. Validators then had no real rows to cross-validate, and choosers profiled none. Each row they keep that equals an original row is now real. - Fixed
fixestpredicting missing values (and so ascorecardfailing with "Input contains NaN") for rows whose level of a fixed effect has no estimate: a level that was not in the training rows, or one that pyfixest dropped (a singleton, or a level separated by having rows of only one class). Such a row is now predicted with that fixed effect at the average of its estimated levels. The estimates of the levels are in the model'seffect_levels_. Afixestmodel can therefore be validated bygroup_k_fold(each held-out group is predicted with the average fixed effect), which used to fail with "could not predict". - Fixed
permutation_importance,shap_partial_dependence, anddecision_regionsfailing for a model that needs columns besides its features, such as the fixed effects and cluster of afixestmodel.permutation_importanceandshap_partial_dependencehold those columns at each row's own values (asshap_importancedoes), anddecision_regionsholds them at their most common values in the real training rows (as it holds the other features at their medians).permutation_importancealso works for models that are not scikit-learn estimators, which scikit-learn's scorers rejected. - Fixed the report of a project saying that an experiment that conserves memory chose "the best of 1 paths". It now gives the number of paths compared.
- Inferers (such as
dr_learnerandpartially_linear) now leave out the rows that a sampler (such asrandom_overorsmote) added to the training rows, which counted some rows more than once and biased the estimates and their standard errors. The data is put back afterwards.
0.5.1¶
- Added a
conserve_memorysetting (fromchrisjen's new option for comparing workers), for an experiment's section or for every experiment in the "general" section. An experiment that conserves memory scores each combination as soon as it is tried and keeps only the best whole dataset so far, rather than every combination's dataset until the last one is done, which ran out of memory with many combinations of a large dataset. Its comparison table, scores, and branches are the same, but only the winner's branch has its wholedataset, so aregression_tablehas only the winner's model.Experiment.outcomeshas the outcome of each combination (its label and group columns, predictions, probabilities, and metrics). Requireschrisjen0.4.0 or later.
0.5.0¶
- A validator resamples only the model's features when it applies the
analysis's samplers to each fold, and gives each copied row the other
columns that the model needs (such as the fixed effects and cluster of a
fixestmodel) from the row it copies, as a sampler does for the groups. Before,smoteand the other samplers that interpolate numbers failed in a validator of afixestmodel whose fixed effects were text. shap_importance(and the SHAP plots, which use it) explains a model that needs columns besides its features, such as afixestmodel, by explaining each row with those columns held at its own values, so its SHAP values are the effects of its features given its fixed effects. Before, it failed because the explained rows had no fixed effects.feature_importance(andimportance_plot) leaves out the features that a model dropped, such as the collinear features that pyfixest drops, rather than failing because there were fewer coefficients than features.
0.4.1¶
regression_tabletakes "sets" of features (such as the dummy variables of one category, as "family, partner, stranger; under_12, teen" in settings), whose members' average marginal effects are each the change from the set's reference (every member 0) to that member alone, rather than from moving each dummy on its own, which made rows that cannot happen.- Added techniques that wrap mlxtend, which the new
mlxtendextra (andall) installs:sequential_selectionandexhaustive_selection, reducers that search for the set of features with which a model (a logistic or linear regression, or "estimator") scores best in cross-validation, folding by the dataset's first group as a model's search does, and store the score of each set as "{name}_search";association_rules, a describer of which values (of the categorical and boolean columns, and of a classified label) tend to appear in the same rows;bias_variance, an evaluator that splits the model's expected loss on the test rows into its bias and variance; anddecision_regions, a plot of the class that a classifier predicts across two features. - Added dtreeviz's plots of decision trees, which the
explainextra now installs:tree_leaf_sizes,tree_leaf_distributions,tree_leaf_purity,tree_feature_space, andtree_prediction_path. They draw adecision_treeor one tree of arandom_forest,extra_trees, oradaboostmodel (andtree_leaf_sizesandtree_leaf_distributionsone tree of anxgboostorlightgbmmodel), in the style of the other figures. dtreeviz's drawing of a whole tree is not wrapped, since it needs Graphviz and makes only SVG files;tree_plotdraws one. models.search_foldsreturns the folds of a hyperparameter search (whichModel._foldsnow calls), so that other techniques can fold by groups as a search does.- Plots that draw with
matplotlib.pyplot(shap's, and now mlxtend's and dtreeviz's) are lent their figure byplots._lent, which also keepspyplot.showfrom opening a window while they draw. - A model's hyperparameter search ("grid", "random", or "optuna") keeps the
rows of each group of the dataset's first group column in one fold, as the
group validators do, when the dataset has groups: with
StratifiedGroupKFoldfor a classifier andGroupKFoldfor a regression. Before, its folds divided the rows at random, so rows of one group (such as the votes of the judges of one case) could be on both sides of a fold and the search scored a model on rows it had partly seen. A row with a missing group is a group of its own. - Brought in the CI fixes of
snickerdoodle0.4.3: GitHub releases are made with the GitHub CLI (in place of the deprecatedgh-action-auto-releaseAction), with the released version's section of CHANGELOG.md as their notes, only frommainand after the tests and linters pass. The test matrix now runs every Python version it names, instead of recreating the environment with Python 3.11 atuv run.
0.4.0¶
- A technique now writes
applyinstead ofimplement, followingchrisjen0.3.0 (now the oldest version thatamosaccepts), whose nodes all do. Callingapplyworks as before: it accepts anything thatDataset.createaccepts, fills in the technique's parameters, and records the technique in the dataset'shistory. That work moved toOperation._call_apply, whichchrisjencalls around eachapply(but not around asuper().applycall from a subclass). A technique that wroteimplementmust rename it toapply. - Added the
automodule, which lets a step's techniques be "auto" in the settings:amosthen chooses techniques that suit the data when the workflow reaches the step. "auto" works in a step that samples, models, or plots (found from the name of the step, or of a worker such as "artist"), andauto_sampler,auto_model, andauto_plotcan be named in any step.auto_samplerresamples only imbalanced classes, with a sampler that suits their size, overlap, and features.auto_modelrules out the models that cannot use the features or whose assumptions the data does not meet (normal errors, collinear features, the dispersion of counts, and so on), cross-validates the rest, and fits the simplest model within one standard error of the best.auto_plotdraws the data before a model is fitted, and the plots that suit the task and the model after. Each records a table of the techniques it considered and why each was or was not chosen, andamos.auto.profilereturns what it found about the data. - Fixed validators,
conformal,explain_weights,feature_importance, and the marginal effects ofregression_tableforlightgbmmodels whose feature names have spaces. lightgbm replaces the spaces with underscores, so the names it reports were not columns of the data: validators failed, and the other techniques named features that the data did not have (andregression_tableleft them out).utilities.feature_namesnow gives back the columns that a model was fitted to. lightgbmis now quiet, as its default "verbose" of -1 meant it to be. The setting never reached lightgbm, which takes it only through**kwargs, so lightgbm printed a warning for each tree it could not split further. A model'skeyword_parametersnow names such parameters.- Added the
regression_tableevaluator, which reports every model the way Stata, R, and statsmodels report regressions: a column for each branch of the experiment (or for the final model), each feature's estimate with stars and its standard error in parentheses, and the kind of estimates, the number of observations, and cross-validated metrics below them. A model that reports its coefficients (the statsmodels and pyfixest models) shows them. Any other model shows each feature's average marginal effect, with standard errors from refitting the model to bootstrap samples of the training rows ("simulations", 100 by default). Set "marginal" to true to show marginal effects for every model.RegressionTable.createmakes one from a dataset, an applied project, or several datasets, and it is saved in the same formats as a scorecard. Word documents, images, andto_textlook like Stata's output ofregress(a block for each model, with its statistics above a table of "Coef." or "dy/dx", "Std. Err.", "t" or "z", the p-value, and the 95% confidence interval), and csv, Markdown, LaTeX, and HTML put the models side by side. Set "style" to "columns" to put them side by side in Word documents and images too.Project.exportsaves each regression table in the workflow. The README shows the tables of the bestlogitandxgboostbranches of its study. - Each
Branchof an experiment now keeps a weak reference to the whole dataset that it made (Branch.dataset), so the fitted model of every branch can be reached after the experiment. Copies and pickles of a branch do not keep it. -
The scorecard's exports are now shared with the regression table. LaTeX tables now escape "<" and ">".
-
A path to a data file passed as a project's
item, or toDataset.create, is now read withnagata's formats, just asload_filereads it, so it may be in any format thatnagataknows (such as json lines, fixed-width, HDF, ORC, XML, or SAS) or compressed (such as "cases.csv.gz"). A project reads it with itsclerk. Before, it was read withamos's own list of 11pandasreaders. A format added tonagata(a subclass ofnagata.base.FileFormat) is now read by an item too. - The error for a file whose format is not known from its name now lists the
extensions that
nagataknows.
0.3.1¶
- Added the
use_gpusetting to the "general" section, which fits the models that can use a GPU (xgboost,catboost,lightgbm, andtabpfn) on an NVIDIA GPU. It is false unless the settings set it to true, and it is kept in the newDataset.use_gpu.amosfinds GPUs by asking NVIDIA's driver, so it needs no other package. If there is no GPU, or a model cannot be fitted on it, the model warns and is fitted on the CPU.exportrecords the GPUs in "environment.json". - DoubleML's and causalml's inferers fit their
outcome_modelandtreatment_modelon the GPU too whenuse_gpuis true. Those packages fit the models themselves, so each model that can use a GPU is first fitted to a few rows on it, and if that fails, it warns and the inferer fits that model on the CPU. tabpfnis now fitted on the CPU unlessuse_gpuis true, as a model or as an inferer's model. Before, it used a GPU whenever PyTorch found one.- Models now record their device in their history's parameters (such as xgboost's "device" or catboost's "task_type").
0.3.0¶
- Fixed the
stratifiedandtrain_testsplitters failing ("only integer scalar arrays can be converted to a scalar index") when the index of the data was text and pyarrow was installed.pandasstores text with pyarrow when it is installed, and scikit-learn cannot select rows from an index that is stored that way. The splitters now give scikit-learn the positions of the rows to divide, asgroup_splitalready did, and look up their index labels afterward. Every split has the same rows as before. - Added a
CITATION.cfffile and a citation section to the README - Changed the development status to Beta
- Made the README badges larger
0.2.7¶
- Updated to the
snickerdoodle0.4.0 template - Made
ruffprefer single quotes - Made
ruffignore boolean default positional arguments (FBT002) - Excluded
uv.lockfrom the large file check
0.2.6¶
- Added mergers, a new genre for the wrangler, for data from tables that
are not organized the same way. A merger matches each row of the data to
a row of another table (its "source": a data file, which is loaded with
the project's clerk, or a table) and adds that row's columns.
merge_keysmatches the row with the same keys,merge_nearestthe row with the nearest date or number, andmerge_rangesthe row whose range has a date or number in it.merge_summaryadds summaries of every row with the same keys. A merger never adds, removes, or reorders rows, and records how many rows it matched in the dataset's history. Every merger takes "columns", "prefix", and "indicator". - Added shapers, a new genre for the wrangler, which change what a row is.
wide_to_longstacks columns into rows andlong_to_widespreads rows into columns, with "stubs" for sets of columns such as "income_2019" and "income_2020".lists_to_rowsmakes a row for each item of a list (such as each judge of a case), andgroup_rowsmakes one row for each group of rows, with summaries of its columns. A shaper comes before the data is split, and takes "label", "task", and "groups" for the reshaped data. - In Python, the genres are
amos.Merger(whose subclasses writematch) andamos.Shaper(whose subclasses writeshape), inamos.mergersandamos.shapers. The advanced user guide has new sections on merging and reshaping data. - Fixed
Project.exportfailing ("keys must be str, int, float, bool or None") when the dataset's history had keys that a json file cannot store. A sampler recorded the number of rows of each class bynumpyvalues when the label waspandasbooleans that allow missing values (the "boolean" type). Samplers now record the classes as plain Python values, andexportsaves any other such key as its plain value or itsstr, as it already saved values.
0.2.5¶
- Renamed effects to inferers and moved them from the analyst to the
critic, since they judge what the data can say about causes. In Python,
amos.effectsis nowamos.inferersandamos.Effectis nowamos.Inferer, and the genre is "inferer" in the library. The names ofpartially_linearandinteractive_regressionin settings are unchanged. The inferers of each package are a genre of their own (Doubleml,Dowhy,Causalml, andTigramite). - Added the rest of DoubleML's models:
partially_linear_iv,partially_logistic,partially_linear_panel,interactive_iv,potential_outcomes,quantile_effects,difference_in_differences,regression_discontinuity, andsample_selection.difference_in_differenceshandles two or more periods, units first treated in different periods, panels (with "unit"), and repeated cross-sections, and stores the effect by the number of periods since the treatment as "{name}_periods".regression_discontinuityis sharp or fuzzy, as the data show, and needs rdrobust. - Added DoWhy's estimators:
regression_adjustment,glm_adjustment,doubly_robust,propensity_matching,propensity_stratification,propensity_weighting,distance_matching, andinstrumental_variable, with bootstrapped confidence intervals ("simulations") and DoWhy's refuters ("refuters"), whose results are stored as "{name}_refutations". - Added causalml's meta-learners:
s_learner,t_learner,x_learner,dr_learner, andtmle, which compare each value of the treatment with a "control" and store the effect for each row as "{name}_effects". causalml's R-learner, causal forest, and doubly robust learner with an instrument are left out, since they do not work in causalml 0.17. - Added tigramite's causal discovery in time series:
pcmci,pcmci_plus, andlpcmci, which store the causal links between the variables that they find, andtime_series_effect, which estimates the effect of one series on the label at a lag. - The
causalextra installs DoubleML, tigramite, rdrobust, and networkx, and causalml on Python 3.11 and 3.12 or DoWhy on Python 3.13 and later. causalml has no version for Python 3.13 and later, and on Python 3.11 and 3.12 the versions of DoWhy that work with pandas 3 cannot be installed with it. causalml's and DoWhy's inferers explain where they cannot be used. - Every class and function that wraps a tool from another package names the tool and its package in a "Wraps:" section of its docstring, with a link to its documentation, so the API reference shows which tool each technique uses.
- Using causalml no longer changes matplotlib's style (causalml sets it to "fivethirtyeight" when its meta-learners are imported).
- The advanced user guide's section on causal inference covers every inferer, with a table of which to use for each design of study.
0.2.4¶
- Renamed scikit-learn's logistic regression from
sk_logittologit(amos.models.Logit), and statsmodels' logistic regression fromlogittologit_sm(amos.models.LogitSM), whose table of coefficients is now "logit_sm_coefficients". Settings that namesk_logitmust uselogit, and settings that namelogitfor statsmodels' model must uselogit_sm. - Added mungers, a new genre for the wrangler. A munger changes what is in
columns, or makes new columns from them, without adding or removing rows,
a whole column at a time with the vectorized methods of pandas.
auto_categorize,convert_types, andstrip_textmoved to the mungers from the cleaners (in Python, they are now inamos.mungers; their names in settings are unchanged). The new mungers areflag_patterns,count_patterns,map_patterns,extract_pattern,extract_all,split_text,replace_text,normalize_text,parse_numbers,parse_dates,parse_booleans,map_values,coalesce,combine_flags, andderive_columns. A munger records the columns that it changed and created in the dataset's history. - Figures share one style. By default, it is SciencePlots' "science" and
"nature" styles (one column of Nature, 3.3 inches wide, with 7-point
text) and its "bright" color cycle, which people with color blindness
can tell apart. Every plot takes "style" (which can be "xkcd"), "colors",
and "latex" (off unless asked for, although "science" turns LaTeX on).
The defaults are
options._PLOT_STYLEandoptions._PLOT_COLORS, and SciencePlots is in theplotsextra. - A plot's usual size is scaled to the width of its style. The SHAP plots
and
influence_plot, whose packages fix the sizes of their text, keep their usual sizes, and the style's text is enlarged to match. Project.exportsaves figures at 300 dots per inch (options._FIGURE_DPI).shap_barandshap_waterfalluse the first two colors of the style's cycle,shap_waterfallwrites each value beside its arrow, and both no longer fail with styles that show minor ticks. The plots that scikit-learn and statsmodels draw (actual_vs_predicted,residual_plot,qq_plot, andpartial_dependence) use the colors of the style's cycle, and axes of categories and heatmaps have no minor ticks.- The README's study adds xgboost and draws a confusion heatmap and a SHAP waterfall. The advanced user guide has new sections on munging data and the styles of figures.
0.2.3¶
- Renamed scikit-learn's logistic regression from
logittosk_logit, and the scikit-learn PCA reducer frompcatopca_reduce, so thatlogitandpcaare the statsmodels techniques below. Settings that namelogitorpcamust use the new names to keep their old behavior. - Replaced lifelines with statsmodels for the survival tools (
cox,kaplan_meier,concordance, andsurvival_curves), so thesurvivalextra installs statsmodels. amos now requires pandas 3. - Added loaders, a new genre for the wrangler:
load_file,download, andopenmlload data through the project's clerk (itsnagata.FileManager). Files are found, and downloads are saved, in the clerk's input folder, and a project with a loader needs noitem. Loaders read every row and read text as UTF-8. - Added validators, a new genre for the analyst:
k_fold,stratified_k_fold,group_k_fold,stratified_group_k_fold,repeated_k_fold,repeated_stratified_k_fold,shuffle_split,stratified_shuffle_split,group_shuffle_split,leave_one_group_out,leave_one_row_out, andtime_series_split. After the model, a validator refits copies of it on folds of the training rows and scores each fold with the critic's metrics. Their means are stored inmetricsas "cv_{metric}", so scorecards and an experiment's comparison show them. - Datasets record the training rows that a sampler made up (
synthetic). Validators never score them, and apply the samplers again in each fold. - Added models from statsmodels, each with a table of coefficients:
logit,probit,mnlogit,ordinal_regression,wls,quantile_regression,robust_regression,mixedlm,gee,binomial_bayes_mixedglm,poisson,negative_binomial,generalized_poisson, andzero_inflated_poisson.mixedlm,gee, andbinomial_bayes_mixedglmuse the dataset's first group unless "groups" names a column. - The statsmodels models that cannot estimate a feature that is a
combination of others (collinear) leave it out, the same way on every
computer: the model's
dropped_lists it, and its row in the table of coefficients is empty. - A
glmorgeeof a family that regresses refuses a classified label, and the models of counts explain how to regress a label of few whole numbers. Effects can use the statsmodels models as learners. - Added
pcaandfactor_analysisto the critic: statsmodels' analyses of the features that the model learned from. influence_plotnow draws aglm.- The README's table of stages lists every technique, divided into the steps of each stage, with a link to each one's API documentation. The advanced user guide has new sections on loading data and cross-validation.
0.2.2¶
- Added eleven plots from shap to the artist:
shap_bar,shap_beeswarm,shap_violin,shap_heatmap,shap_decision,shap_embedding,shap_waterfall,shap_force,shap_scatter(a dependence plot),shap_partial_dependence, andshap_group_difference. They draw the SHAP values thatshap_importancefound (or find them), for the class chosen with "category" (by default, the last class). shap draws withmatplotlib.pyplot, so these plots lend it their figure while it draws, without opening a window, and leave pyplot as it was. The random numbers that shap uses to jitter dots and to bootstrap are seeded with the dataset's seed, so the figures are reproducible. - Added plots from the other packages:
- scikit-learn:
calibration_curve,det_curve,partial_dependence,learning_curve,validation_curve, andtree_plot. - seaborn:
box_plots,count_plots,pair_plot,label_plot, andmissing_heatmap, split or colored by the label's classes (or by a group, or by "by"). - statsmodels:
qq_plotandinfluence_plot. - InterpretML:
shape_functions, the shape functions of anexplainable_boostingmodel. - Plots of the tables made with other packages:
coefficient_plot(of the coefficients ofols,glm,fixest, orcox, or of an effect from DoubleML),fairness_plot(fairlearn),prediction_intervals(MAPIE), andsearch_plot(of any search, including Optuna's). survival_curvescan add a table of the number of rows at risk (at_risk).- A plot can have its own usual size (
Plot.size), which "width" and "height" still change, and a plot whose tool makes its own figure (as shap's force plot does) can return that figure fromdraw. - Moved the technique catalog out of the advanced user guide into its own
page of the user guide, "Technique Catalog". Its tables are written from
the techniques' docstrings by
docs/scripts/technique_catalog.py, and a test checks that they are up to date.
0.2.1¶
- Replaced the
scorecardtechnique of the critic stage withScorecard, which compares every branch of an analysis: one row for each combination of techniques that the most recentexperimenttried, ranked by its criterion, with the technique used at each step and every standard metric for the task, computed from each branch's own predictions. It still stores the final model's scores in the dataset'smetrics. Its table now has one row for each branch (instead of one row for each metric). - A scorecard can be saved as a csv file (
to_csv), a Markdown table (to_markdown), a Word document (to_word), or an image (to_image), or in all four formats at once (export).Scorecard.createmakes one from a dataset or an applied project, andProject.scorecardreturns the project's scorecard.Project.exportsaves it in every format. - An
experimentnow keeps aBranch(the technique used at each step, the score, and the predictions) for every combination in the winning dataset'sbranches. - Added the
wordextra, which installs python-docx for Word documents. - Added the scorecard of the README's breast cancer study to the README.
- Added
groupstoDataset(and a "groups" setting in the "general" section): columns that identify groups of people or places, which stay in the data but are not features. Cleaners and samplers keep them (synthetic rows have none), andgroup_splituses the first group by default. - Added support for 13 more packages, for 139 techniques in ten genres:
- fairlearn: six fairness metrics (
demographic_parity,equalized_odds, andequal_opportunity, with a "_ratio" version of each) in the newGroupMetricgenre, and thefairnessevaluator, which compares the model across groups. Thescorecardaddsdemographic_parityandequalized_oddsfor every branch when a dataset has groups and a label with two classes. -
Mapie
the
conformalevaluator, which makes prediction intervals (or sets of classes) with a known rate of coverage. - eli5: the
explain_weightsevaluator. - InterpretML: the
explainable_boostingmodel, whose term importancesfeature_importancereports. - CatBoost: the
catboostmodel, which uses categorical columns directly. - TabPFN: the
tabpfnmodel (in its owntabpfnextra, which is not part ofallbecause it needs PyTorch). - pyfixest: the
fixestmodel, a regression (or logit) with fixed effects and clustered standard errors, whose coefficients are stored in a table. - lifelines: the
coxmodel, theconcordancemetric, thekaplan_meierdescriber, and thesurvival_curvesplot. - DoubleML: the new
Effectgenre, withpartially_linearandinteractive_regression, which estimate the causal effect of a treatment with double machine learning. - skrub: the
date_parts,gap,min_hash, andtfidfencoders. - Optuna:
search = "optuna"for any model. - Polars:
Dataset.createaccepts Polars data frames (lazy or not). - great_tables: scorecards as HTML tables (
to_html). Scorecards can also be saved as LaTeX tables (to_latex), andexportsaves both. - Added the
causal,fairness,polars,survival,tables,tuning,uncertainty, andtabpfnextras, and added packages to theboosting,encoders,explain, andstatisticsextras. - Added
Dataset.dates, the names of the date and time columns. - Code that calls pyfixest no longer changes the level or handlers of the root logger.
- Added recipes for fairness and for fixed effects, and sections of the advanced user guide on groups and fairness, uncertainty, causal effects, and survival analysis.
- Left private classes, methods, and functions out of the API documentation.
0.2.0¶
- Rebuilt
amosas Automated Modeling for Open Scholarship: a package for reproducible data science in academic research, built onchrisjen0.2.0. A study is described in a settings file (or adict), whichchrisjenturns into a workflow of workers, steps, and techniques. - Added
Dataset, the item that flows through anamosworkflow. It keeps the data in onepandas.DataFramewith the label, the training and test rows, the fitted model, its predictions and probabilities, metrics, tables, figures, fitted tools, and ahistoryof every technique applied. - Added
Operation, the base class of everyamostechnique, and 116 techniques in nine genres, each stored in thechrisjenlibrary under its snake case name: cleaners (10), describers (6), splitters (4), transformers (imputers, scalers, encoders, mixers, and reducers: 37), samplers (9), models (19), metrics (17), evaluators (6), and plots (8). They wrap scikit-learn, category_encoders, imbalanced-learn, xgboost, lightgbm, statsmodels, shap, matplotlib, and seaborn. Optional packages are imported only when they are used, and are installed with extras (such asamos[all]). - Transformers and samplers learn from the training rows only, keep named
columns, can be limited to some
columns, and are given the label when they are fitted. Models do both tasks where they can, search for the best hyperparameters when asked, and (witholsandglm) report coefficients with standard errors, p-values, and confidence intervals. Every metric is also achrisjen.Criteria, so it can be an experiment's criterion. - Added the
Experimentdesign, which tries every combination of techniques, keeps the best, and adds a table comparing every combination. - Added
amos.Project, which makes data into aDataset, reads "label", "task", and "seed" from the "general" section of the settings, applies the workflow to a copy of the data, passes the seed to every tool that takes arandom_state, and exports the report, settings, environment, history, predictions, tables, and figures. - Added the
Findingsreport. - Added an ROC curve and an importance plot from the README's breast cancer
study to the README, with
docs/scripts/readme_figures.pyto draw them again. - Added tests that compare
amoswith each package that it wraps, using the same data, parameters, and seed. - Removed the general-purpose containers, converters, factories, and
registries of 0.1.x. They now live in
bunches,camina,holden, andwonka. - Moved to the
snickerdoodletemplate, based onuvandhatchling, with ruff, mypy, pre-commit, mkdocs, and GitHub Actions. The README and documentation examples are run by the unit tests.
0.1.10¶
- The last release of the earlier, general-purpose
amos, a toolkit of containers and converters for Python projects.