Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Make ML notebook work with Dev Edition and IBM Cloud
Browse files Browse the repository at this point in the history
* Make the ML deployment work with IBM Cloud ML for Dev Edition
* Add final arch/flow diagram
* Add usual files
* Add ACK
  • Loading branch information
markstur committed Jan 31, 2019
1 parent eb2e97b commit d7cff42
Show file tree
Hide file tree
Showing 9 changed files with 784 additions and 427 deletions.
4 changes: 4 additions & 0 deletions ACKNOWLEDGEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Acknowledgements

* Credit goes to [Frank Sun](https://twitter.com/sun_xi_frank) for the original notebooks and documentation that became this code pattern.
* The content was taken from https://github.com/IBMProjectEventStore/db2eventstore-IoT-Analytics and adapted to be more Developer Edition friendly.
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contributing

This is an open source project, and we appreciate your help!

We use the GitHub issue tracker to discuss new features and non-trivial bugs.

In addition to the issue tracker, [#journeys on
Slack](https://dwopen.slack.com) is the best way to get into contact with the
project's maintainers.

To contribute code, documentation, or tests, please submit a pull request to
the GitHub repository. Generally, we expect two maintainers to review your pull
request before it is approved for merging. For more details, see the
[MAINTAINERS](MAINTAINERS.md) page.

Contributions are subject to the [Developer Certificate of Origin, Version 1.1](https://developercertificate.org/) and the [Apache License, Version 2](https://www.apache.org/licenses/LICENSE-2.0.txt).
69 changes: 69 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Maintainers Guide

This guide is intended for maintainers - anybody with commit access to one or
more Code Pattern repositories.

## Methodology

This repository does not have a traditional release management cycle, but
should instead be maintained as a useful, working, and polished reference at
all times. While all work can therefore be focused on the master branch, the
quality of this branch should never be compromised.

The remainder of this document details how to merge pull requests to the
repositories.

## Merge approval

The project maintainers use LGTM (Looks Good To Me) in comments on the pull
request to indicate acceptance prior to merging. A change requires LGTMs from
two project maintainers. If the code is written by a maintainer, the change
only requires one additional LGTM.

## Reviewing Pull Requests

We recommend reviewing pull requests directly within GitHub. This allows a
public commentary on changes, providing transparency for all users. When
providing feedback be civil, courteous, and kind. Disagreement is fine, so long
as the discourse is carried out politely. If we see a record of uncivil or
abusive comments, we will revoke your commit privileges and invite you to leave
the project.

During your review, consider the following points:

### Does the change have positive impact?

Some proposed changes may not represent a positive impact to the project. Ask
whether or not the change will make understanding the code easier, or if it
could simply be a personal preference on the part of the author (see
[bikeshedding](https://en.wiktionary.org/wiki/bikeshedding)).

Pull requests that do not have a clear positive impact should be closed without
merging.

### Do the changes make sense?

If you do not understand what the changes are or what they accomplish, ask the
author for clarification. Ask the author to add comments and/or clarify test
case names to make the intentions clear.

At times, such clarification will reveal that the author may not be using the
code correctly, or is unaware of features that accommodate their needs. If you
feel this is the case, work up a code sample that would address the pull
request for them, and feel free to close the pull request once they confirm.

### Does the change introduce a new feature?

For any given pull request, ask yourself "is this a new feature?" If so, does
the pull request (or associated issue) contain narrative indicating the need
for the feature? If not, ask them to provide that information.

Are new unit tests in place that test all new behaviors introduced? If not, do
not merge the feature until they are! Is documentation in place for the new
feature? (See the documentation guidelines). If not do not merge the feature
until it is! Is the feature necessary for general use cases? Try and keep the
scope of any given component narrow. If a proposed feature does not fit that
scope, recommend to the user that they maintain the feature on their own, and
close the request. You may also recommend that they see if the feature gains
traction among other users, and suggest they re-submit when they can show such
support.
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ After completing this code pattern, you’ll understand how to:
6. [Analyze the data](#6-analyze-the-data)
7. [Create and deploy a machine learning model](#7-create-and-deploy-a-machine-learning-model)

<!--
1. [Visualize the data](#6-visualize-the-data)
2. [Create Watson services with IBM Cloud](#2-create-watson-services-with-ibm-cloud)
2. Setup a Event Store database and table
3. Perform multiple data science tasks with Event Store using Jupyter notebooks
4. Interact with Event Store database using REST API
5. Run example IBM Streams and Remote Access Applications with Event Store
-->

### 1. Clone the repo

Clone the `db2-event-store-iot-analytics` repo locally. In a terminal, run:
Expand Down Expand Up @@ -132,14 +123,29 @@ If you are using the **Developer Edition** of Db2 Event Store, you need an IBM C

* Sign in and create the service [here](https://console.ng.bluemix.net/catalog/services/machine-learning).
* Click on `Service credentials` and then `New credential` and `Add`.
Use `View credentials` and copy the credentials JSON.
* Use `View credentials` and copy the credentials JSON.
* You will use the JSON to set the `wml_credentials` variable in the notebook.
* The notebook will pip install watson-machine-learning-client. After the install, you usually need to restart your kernel and run the notebook again from the top.

Load the notebook, using the file **`Event_Store_Data_Analytics.ipynb`**.

Once the model is built and deployed, you can easily send it a new measurement and get a predicted temperature (one at a time or in batches).

##### Given a new data point

```python
new_data = {"deviceID" : 2, "sensorID": 24, "ts": 1541430459386, "ambient_temp": 30, "power": 10}
```

##### The result includes a predicted temperature

```python
predictions: [48.98055760884435]
```

## Sample output

See the notebooks with example output here: [notebook examples with result](examples)
See all the notebooks with example output [here](examples).

## License

Expand Down
Binary file modified doc/source/images/architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions examples/Event_Store_Data_Analytics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1932,7 +1932,6 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true,
"deletable": true,
"editable": true
},
Expand Down Expand Up @@ -1978,7 +1977,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.3"
"version": "3.6.4"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit d7cff42

Please sign in to comment.