Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project Restructuring #32

Open
patrickjquinn opened this issue Feb 8, 2017 · 22 comments
Open

Project Restructuring #32

patrickjquinn opened this issue Feb 8, 2017 · 22 comments
Labels

Comments

@patrickjquinn
Copy link
Owner

patrickjquinn commented Feb 8, 2017

Hi Guys, i'm currently planning a re-structuring to make this project more accessible and add a strictly defined structure that will foster further growth without adding layers of confusion & complexity. This is the first step toward making P-Brain a truly intelligent system.

The proposal is to re-structure the project to mirror that of the human brain. It could potentially look as follows:

Current Project Structure:

/api/
src/
src/
log/
docs/
skills/
test/
config/
server
yarn.lock
tremux.sh
README.md
Dockerfile
package.json

Proposed Project Structure:

lobes/
	/parietal - maps request to skill
	/temporal - Stores any memory based task such as name, location, own name etc
	/occipital - always running, self training which is constantly running and learning from responses and requests
	/frontal - natural language interpretation, acts on commands and queries 

stem - Contains the interface of the server, i/o for request:response pairs

cerebellum - any management task such as thread management, timing or synchronized activities live here

neurons - skills, extendible etc


yarn.lock - Package Management 

scripts/
	  /tremux.sh - Running the project on an Android device end-to-end

README.md - Project info
Dockerfile - Docker config 
package.json - Package and script manifest
@timstableford
Copy link
Collaborator

Personally, I find that far more confusing and way less intuitive, from a developer perspective. I think it would be time better spent perhaps splitting into core-skills and user-skills (with the contents of user skills in the .gitignore). Or.... perhaps in the skills directory have sub-folders called 'innate', 'learned' and 'passive'. Innate would be skills with hard rules, learned would be skills with intents, passive would be skills with neither that just provide a utility.

My thoughts may be quite different to where you want to take the project though :)

@patrickjquinn
Copy link
Owner Author

Well whatever I do here needs to be what the developers contributing to the project want (as arguably they're far more important than I am to the projects future). I wanted a non-computer science structure to the project and something far more universal (Whats more universal than the human brain!)

https://s-media-cache-ak0.pinimg.com/originals/dd/71/8b/dd718b2f6aadcf6894e5c9df39fb273e.png this infographic has a fairly concise breakdown of the functions of the brain which lines up with the purpose of each defined section of the proposed project structure.

When expanding the project in future we can ask 'what part of the brain handles this sort of thing' and then we can place the relevant code in that sub-section of the project. We can also ask 'what else would the brain do here' as a catalyst for project advancement. That said, even if we dont go down this route, we still need to have a more universal, plain english structure for the project so its immediately clear as to what each section is doing without having to wade through code.

@timstableford
Copy link
Collaborator

The problem I tend to have with this is that there's probably more people that can program than there are that now the structure of the human brain. We'll have to wait to see if anyone else chimes in I guess 👍

@patrickjquinn
Copy link
Owner Author

Yep we will leave the question open, I would assume you're correct but if people see that infographic and find that it makes sense then we can think about moving forward. The end goal for P-Brain was always to build a self contained mini brain, hence P-Brain (ignoring the fact that i'm Pat and its my brain project)

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

i was thinking about changing structure to easily add plugins.
also wanted to parse response of speech recognition first.. before publishing it to user

@patrickjquinn
Copy link
Owner Author

What was the structure you where thinking of?

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

something more like:
input => question => intent => answer
so we could display in UI: Q/A from server,
example: remove some words or change some words in questions.
also single answer could be assembled from couple sources(google/maps/wolfram)

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

also 1 question could map to different intents.. we could assemble answers from all of intents or use previous history to check context of question and then use single intent.

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

wdyt?

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

plugin system could work like that:
example plugin 'cooking-reciepie'
1.write code in /src/ directory
/input
/intent
/question
/answer(AKA skill)
2. npm publish
3. in pbrain deployed server

npm i P-Brain.ai/cookieng-reciepie --save
  1. require plugin in server.js

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

@patrickjquinn if you want i can first add db to the project, as a smaller MR...

@patrickjquinn
Copy link
Owner Author

This all sounds find with me, however you have to bear in mind that this server has to be client agnostic (we also have a raspberry Pi, iOS and Android client not jus the web client).

Also the skills need to be totally self contained, a skill developer should only need knowledge of how skills should work, their structure etc, they should not need to know any thing lower level than that

Otherwise you run the risk of creating a coupled system that can not be easily modified or expanded and will wind up as spaghetti code.

I've written enough crappy code to know what causes it (not saying what you're proposing is bad, just to keep in mind :) )

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

thanks for mentioning raspberry pie...
I found that the are binaries for it:
http://andyfelong.com/2016/01/mongodb-3-0-9-binaries-for-raspberry-pi-2-jessie/

@syzer
Copy link
Contributor

syzer commented Feb 13, 2017

as long as clients connect via specified api it should be fine :)

@timstableford
Copy link
Collaborator

@syzer check out the SSL/Auth issue for the proposition for the database interface and let use know what changes you think we should make.

@grantcodes
Copy link

I agree that structuring it around the parts of the brain is confusing. I would prefer just naming things after what they do, for example: skillMapper is more obvious than parietal.

Having said that I think the better improvement would be to make everything more npm friendly. Mainly having skills as npm modules would be perfect, also maybe making them classes that extend a base skill class would be smart. Finally it would be good to export the entire project as a module so that it could be used inside other projects (although that may go against the goals of the project)

@patrickjquinn
Copy link
Owner Author

hey @terminalpixel that second part sounds like a good idea, i'll look into it but in the mean time feel free to submit anything as pull requests 👍

@syzer
Copy link
Contributor

syzer commented Mar 5, 2017 via email

@grantcodes
Copy link

I've had a first go at restructuring the skills as classes: https://github.com/grantcodes/P-Brain.ai/tree/extendable-skills

I need to do a lot of tidying, testing and updating. But I think it feels like a step in the right direction

@timstableford
Copy link
Collaborator

@grantcodes I agree. Looks good. Make a PR when you're ready :)

@syzer
Copy link
Contributor

syzer commented Mar 29, 2017 via email

@patrickjquinn
Copy link
Owner Author

Yep your branch is behind the master by a bit, can you sync it with master an create a PR? Once done i'll accept it and merge it into the master! Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants