Restructure into the aima package + converge all editions into one suffix-free module set (#1188)#1340
Restructure into the aima package + converge all editions into one suffix-free module set (#1188)#1340dmeoli wants to merge 5 commits into
aima package + converge all editions into one suffix-free module set (#1188)#1340Conversation
…ence) Move all library modules under a single importable package: from search import X becomes from aima.search import X (or from aima import search), per the decision on #1188 to make the repo a proper package. This commit is the mechanical package move; the 3e/4e content convergence (unifying the X/X4e pairs) follows as Stage 2 on this branch. - git mv the 31 modules into aima/ and add aima/__init__.py. - Rewire every intra-package import to from aima.<mod>, and update all tests, notebooks, gui/ and the Sphinx automodule directives accordingly. - Fix the aima-data lookups that were anchored to dirname(__file__) (utils, utils4e, text) to resolve from the repo root now that the modules live one level down. - Add pyproject.toml (installable via pip install -e ., deps from requirements.txt) and note the new import/usage style in the README. Full test suite passes (502) and the Sphinx docs build with 0 warnings. BREAKING: top-level imports like 'from search import X' no longer work; use 'from aima.search import X'.
…einforcement_learning4e) These 4e modules duplicated the same public symbols as their canonical counterparts, were imported only by their own tests, and added no unique 4e algorithms (agents/rl: identical symbol sets; logic4e's only 'unique' names were naming variants KB_AgentProgram/extend already present as KBAgentProgram and utils.extend). Per the #1188 convergence (keep the used base, drop the parallel 4e branch), delete them plus their tests and docs entries. Shared-symbol 4e implementations remain available in git history and can be re-adopted as deliberate per-algorithm 4e upgrades.
) Fold each X4e's genuinely-new 4e algorithms into the canonical aima/X.py, keep the used base for shared symbols, then delete the X4e duplicate + reconcile tests: - games: + monte_carlo_tree_search, mcts_player (MCTS); games4e removed - mdp: + pomdp_lookahead, update_belief, q_value (DDN); mdp4e removed - nlp: + Tree, subspan, TextParsingProblem, astar_search_parsing, beam_search_parsing; nlp4e removed - probability: + is_independent, gen_possible_events, gaussian_probability, logistic_probability, ContinuousBayesNode, complied_burglary; probability4e removed - utils: + gaussian_kernel(_1D/_2D), conv1D, map_vector, MCT_Node, ucb (used by the MCTS above); perception4e and making_simple_decisions4e repointed to aima.utils Notebooks and docs updated to the canonical modules. Skipped naming-variant duplicates (expect_min_max_player, model_selection, KB_AgentProgram, extend). DEFERRED: the utils/learning convergence for the 4e ML cluster (utils4e, learning4e, deep_learning4e) — they are mutually coupled through the 4e DataSet.sanitize convention (drops the target) and the recursive vector helpers, so unifying them requires porting that cluster as its own effort. utils4e and learning4e are kept for now. Full suite: 407 passed; docs build with 0 warnings.
aima package (Stage 1: package move)aima package + converge 7/9 3e-4e module pairs
…1188 Port the last 2 deferred pairs so there is one module per topic: - learning.DataSet.sanitize now drops the target (the 4e convention) - verified it leaves the 3e learning tests green and is what the neural-net learners need. - learning.err_ratio / grade_learner accept either a callable predictor or a learner object with a .predict method (so the 4e class-learners work through the canonical learning); backward-compatible with the 3e closures. - deep_learning4e imports the canonical aima.utils and defines locally the recursive vector helpers (element_wise_product/vector_add/scalar_vector_product) the neural net needs on nested weights (aima.utils keeps the flat tuple/np versions required by the grid/search code). - Delete utils4e.py and learning4e.py (no genuinely-unique symbols remained - model_selection duplicated cross_validation_wrapper); repoint test_deep_learning4e and Learners.ipynb to aima.learning; drop the duplicate test_learning4e. All 9 X/X4e pairs are now unified. Full suite: 393 passed; docs 0 warnings.
aima package + converge 7/9 3e-4e module pairsaima package + converge all 3e/4e module pairs (#1188)
|
@norvig this is ready for your review before merge. It implements the edition policy you set in #1188 (converge on 4e, stop maintaining two trees) and turns the library into an importable
The one thing to weigh is that it's a breaking import change ( |
Now that every topic has a single version, rename the 4e-only modules (which had no 3e counterpart) to plain topic names, and converge the notebook helper pair: - deep_learning4e -> deep_learning, game_theory4e -> game_theory, making_simple_decisions4e -> making_simple_decisions, perception4e -> perception (modules + their tests renamed). - notebook4e folded into notebook_utils (it was a superset: + plot_model_boundary); notebook4e deleted. (notebook_utils keeps the Jupyter-collision-safe name from #1294.) - Repointed every import across modules, tests, notebooks, gui and the Sphinx docs; renamed game_theory4e.ipynb -> game_theory.ipynb. No '*4e' modules remain. Full suite: 393 passed; docs build with 0 warnings.
aima package + converge all 3e/4e module pairs (#1188)aima package + converge all editions into one suffix-free module set (#1188)
|
Pushed a follow-up commit completing the convergence: now that every topic has a single version, all remaining Note: moving the top-level notebooks under |
What
Implements the #1188 decision — converge on the 4th edition and make the library a proper package — in three stages on this branch.
Stage 1 —
aimapackageAll library modules moved under one importable package:
from aima.search import astar_search(orfrom aima import search). Imports rewired across modules, tests, notebooks, gui/ and the Sphinx config;aima-datalookups fixed;pyproject.tomladded (pip install -e .).Stage 2 + 3 — 3e/4e convergence (all 9 pairs)
The canonical (used) module wins for shared symbols; genuinely-new 4e algorithms are folded in; the
*4eduplicate + its tests are deleted; consumers/notebooks repointed.+ monte_carlo_tree_search,mcts_player.+ pomdp_lookahead,update_belief(Dynamic Decision Networks).+ TextParsingProblem,Tree,astar_search_parsing,beam_search_parsing,subspan.+ gaussian_probability,logistic_probability,is_independent,ContinuousBayesNode.+ gaussian_kernel(_1D/_2D),conv1D,map_vector,MCT_Node,ucb.DataSet.sanitizeadopts the 4e convention (drops the target);err_ratio/grade_learnernow accept either a callable predictor or a.predictlearner object (so the 4e class-learners work through the canonical learning, backward-compatible with the 3e closures).deep_learning4ekeeps the recursive vector helpers it needs locally, since the grid/search code needsaima.utils' flat tuple/np versions.Naming-variant duplicates were skipped (
expect_min_max_player,model_selection,KB_AgentProgram,extend). The genuinely 4e-only modules with no 3e counterpart (deep_learning4e,game_theory4e,making_simple_decisions4e,notebook4e,perception4e) stay.Verification
from search import Xno longer works →from aima.search import X. This affects downstream users and any open forks/PRs, so we'd like @norvig (and other maintainers) to review before merging. It directly implements the edition policy from #1188 and pairs naturally with the broadernotebooks/+ generate-.py-from-.ipynbrestructure idea discussed separately.