aimacode / aima-julia

Julia implementation of algorithms from Russell And Norvig's "Artificial Intelligence - A Modern Approach"
MIT License
126 stars 50 forks source link

Make this repository more Julia-esque #12

Closed femtotrader closed 6 years ago

femtotrader commented 6 years ago

Hello,

most Julia repositories

Kind regards

femtotrader commented 6 years ago

A good way to start a new Julia project is to use PkgDev

julia> Pkg.add("PkgDev")
julia> using PkgDev
julia> PkgDev.generate("Aima.jl", "MIT")
sambitdash commented 6 years ago

@femtotrader While your focus is making the package Julia-sque as a practitioner it will definitely help if the code is designed in a manner such that the core APIs are abstracted out as a core package while samples are kept separate as example code.

A practitioner can load the library using AIMACore. And then should be able to reuse the original core APIs as is without having to bother about the sample code. He can refer to the sample code but it should normally affect him in his normal development of solving additional problem.

This was my original suggestion for #9. But that time, I did not have enough understanding of the programming paradigm of Julia and @mikhail-j was clearly very focused on developing a running system in Julia. Clearly, he was also trying to figure out many complexities of a newly developed language. In view of that, I started an independent project without forking this project to create an outline. However, did not find enough time to pursue to the extent this library has been in terms of functionality. My attempt can be seen at:

https://github.com/sambitdash/AIMASamples.jl

As you can see in my package the core library files are kept separate while samples are independent files. Now that the current library has come to a large implementation, I will like to suggest if now some refactoring can be carried out such that core part of the library can be made a separate library which can be used by practitioners independently while samples can use the core package.

Julia is an upcoming language and new packages are getting developed. It does not have a consolidated AI package as such. While AIMA algorithms are proven over 20 years of research and fundamentally very sound for many many practical applications. My suggestion will be to split the package into 2 parts.

  1. AIMACore - Concept and Core Al algorithms (like breadth-first-search, agent and agent algorithm patterns). The code will be kept verbatim as described in the book so that original intent of AIMA book sample code is preserved. The performance or application specific practitioners anyway will develop their special purpose implementations.
  2. AIMASamples - Concrete examples like Wumpus world etc.

AIMASamples can use AIMACore to showcase all the samples described in the book. The practitioners can use AIMACore as a Julia package to develop their other functional applications. Having AIMACore as a unified AI library for Julia will make the language robust as much as it will also keep the sample code cleaner.

@norvig as a thought leader and architect, please suggest if you think this will be an ideal approach to proceed.

Moreover, Julia has now many interesting packages with DataStructures which can be reused as is or with minimal shim layer for many of the low label data structures than to re-implement them.

I will suggest persons working on this to look at #14, #12 as a single project to ensure the efforts can be consolidated. I will be happy to contribute if you this my suggestions can be beneficial in someways.

regards,

Sambit

mikhail-j commented 6 years ago

Hi @femtotrader and @sambitdash

Thank you for your interest in aima-julia. I would like to respond to the points you have made:

@femtotrader

follow a naming convention https://github.com/aimacode/Aima.jl should be better

It’s currently named aima-julia to maintain consistency with the other projects on https://github.com/aimacode but I see no reason why the name couldn’t change in the future but you should email Professor Norvig to inquire about that.

should (at least) be easily installable using julia> Pkg.clone("https://github.com/aimacode/Aima.jl") have code in /src directory

It seems like you would like this project to be a package. This repository is not intended to be cloned with Pkg.clone(), particularly because the code is not meant for use in production but rather academic use.

AIMA-Julia was developed using https://github.com/aimacode/aima-python as the primary reference so its structure reflects the latest state of the most comprehensive and well thought out AIMA project. The code is meant to be used as example implementations of the pseudocode accompanied by the Jupyter notebooks (this needs to be worked on) rather than a package that can be installed through julia package manager.

have unit tests with testset

@testset should not be required for most purposes, particularly because many Base.Test tests have unique keyword arguments and specific input examples.

should work with Julia 0.6 (and maybe also with nightly) (see #14 )

I would greatly appreciate help with creating/updating IJulia notebooks but please follow the guidelines here: CONTRIBUTING.md

@sambitdash

This project follows the code style and philosophy of Python, Lisp and Haskell because the primary intended audience is undergraduate and graduate students with some experience in mathematics, not software engineering practitioners. Please always keep this in mind.

Thus, maintaining readability, conciseness, and elegance is valued over increasing performance or making it an production-grade package like DataStructures.jl which is designed for use in applications.

Having followed and worked with Julia since its public announcement in 2012, I would say that the language is not complex, it is basically a Lisp derivative similar to Dylan. I have spent a great deal of time carefully analyzing the aima-python and aima-lisp projects in order to weigh the tradeoffs of design decisions thoroughly to assess how one could unwittingly negatively impact the intended audience (students). I recommend you do the same.

norvig commented 6 years ago

I agree with @mikhail-j -- the purpose of this repository is education, not production, so readability and compatibility with the book is what we are going for, not being a standard production Julia package.