Giter Club home page Giter Club logo

django-ai's Introduction

django-ai

https://travis-ci.org/math-a3k/django-ai.svg?branch=master

Artificial Intelligence for Django

django-ai is a collection of apps for integrating statistical models into your Django project so you can implement machine learning conveniently.

It integrates several libraries and engines providing your Django app with a set of tools so you can leverage the data generated in your project.

http://django-ai.readthedocs.io/en/latest/_images/django_ai.jpg

Documentation

The full documentation is at https://django-ai.readthedocs.io or the /docs directory for offline reading.

Features

See the Introduction section in the documentation for more information.

Communication Channels

Quickstart

The easiest way of trying django-ai is inside its package:

  1. Create a virtual environment and activate it:

    python3 -m venv django-ai_env
    source django-ai_env/bin/activate
    
  2. Upgrade pip and install django-ai:

    (django-ai_env) pip install --upgrade pip
    (django-ai_env) pip install django-ai
    
  3. Change into the django-ai directory, i.e.:

    (django-ai_env) cd django-ai_env/lib/python3.5/site-packages/django_ai
    
  4. Create the migrations for the dependencies and apply them:

    python manage.py makemigrations
    python manage.py migrate
    
  5. Create a superuser:

    python manage.py createsuperuser
    
  6. Start the development server and visit http://127.0.0.1:8000/admin/, look at the examples and start creating your statistical models:

    python manage.py runserver
    

You can also clone it from the repository and install the requirements in a virtualenv:

git clone [email protected]:math-a3k/django-ai.git

and following the previous steps, install the requirements - pip install -r requirements.txt - in a virtual environment instead of the package.

For installing it in your project, please refer here.

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements_test.txt
(myenv) $ PYTHONHASHSEED=0 python runtests.py

django-ai's People

Contributors

dependabot[bot] avatar math-a3k avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-ai's Issues

Getting ModuleNotFoundError: No module named 'bayesian_networks' while integrating django-ai with a basic django project.

  • django-ai version:0.0.2.1
  • Django version:2.0.10
  • Python version:3.6
  • Operating System:Windows 10

Description

I have created a Django project and then trying to integrate django-ai with it by following below link-
https://django-ai.readthedocs.io/en/latest/installation.html

What I Did

When I ran 'python manage.py makemigrations 'command as mentioned in above ink I got following error: ModuleNotFoundError: No module named 'bayesian_networks'.

my settings.py snippet is as below-
`DEBUG = True

ALLOWED_HOSTS = []

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# Dependencies
'nested_admin',

# django-ai apps
'django_ai.base',
'django_ai.bayesian_networks',
'django_ai.supervised_learning',
'django_ai.systems.spam_filtering',

# optional but highly recommended
'django_ai.examples',

]`

I tried to search in internet but I have not found any solution so I am asking here. Let me know if anything I am missing here.

CommonInfo/CreatedInfo model improvements

Update

This issue was posted in the wrong repo because of a confusión with names, it can be kindly ignored

Description

As of version 5.5.2 of django-ai-core, I believe there is a little room for improvement on this model:

  • It uses default=now on created_at and lastmodified_at fields, instead of the good old auto_now=True and auto_now_add=True, which is cleaner and does not make these fields visible/editable on modelForms by default, which is ideal for audit purposes.
  • The created_by and lastmodified_by fields should have the editable flag set to False so they are fully automatic and not visible on forms by default.

The current settings are not wrong, but I believe the ones I'm proposing suit more the typical use case for Django Models.

How I believe the fields should look like

created_at = models.DateTimeField(_("Created at"), auto_now_add=True, db_index=True)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("Created by"), blank=True, null=True,
                                   related_name="%(app_label)s_%(class)s_created", on_delete=models.SET_NULL, editable=False)
lastmodified_at = models.DateTimeField(_("Last modified at"), auto_now=True, db_index=True)
lastmodified_by = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("Last modified by"), blank=True,
                                        null=True, related_name="%(app_label)s_%(class)s_lastmodified",
                                        on_delete=models.SET_NULL, editable=False)

Support for all kinds of graphs in Bayesian Networks

Because of how BayesPy is designed, the nodes involved in a network must be the same objects - in the construction / initialization of each and when the inference engine is called - because they pass messages between each other. If the objects are recreated, i.e., on another request cycle, that won't work.

Currently Bayesian Networks support "one level of depth" graphs, it should support all kinds of graphs. This means that all the nodes in the DAG must be created accordingly - with their dependencies - ""at once"" / ""in the sample place"".

One way could be start initializing the parent-less nodes, then "go down" to the children (which may have other parents, but they are already initialized)

See https://github.com/math-a3k/django-ai/blob/master/django_ai/bayesian_networks/models.py#L75

Linear Regression Support

The goal of this issue is to add support for Linear Regression using the scikit-learn engine for django-ai.

Its scope is limited only for Ordinary Least Squares, setting the building block for incorporating the Generalized Linear Models provided in the scikit-learn module.

Insights

  • Thoroughly read the documentation on django-ai's API - specially on "Design Goals", "Engine related" and "Supervised Learning Technique"
  • Create a class on the appropriate place that inherits from SupervisedLearningTechique and implements Regression.
  • Implement on that class all the methods in the django-ai's API accordingly for incorporating this technique implementation - a reference implementation can be found here, which is the analogous for SVM using the same engine.
    • Note: The class and all fields should be documented in a way that Sphinx can generate the documentation
  • Create a simple test which proves the correct functioning of the implementation and covers all the essential parts of the implementation, analogous to this one.
  • Create the admin front-end for the technique, like is done here.
  • Create the documentation for the technique, like is done here
  • Provide an example of the technique like is done here.
    • Note that the example is not about a Linear Regression, but how to incorporate the use of a Linear Regression into a Django application to improve its functionality or solve an issue seamlessly.
  • You may have to create tests accordingly so the general testing coverage does not descend, see here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.