This is a guide on how to install Caffe for Ubuntu 16.04 and above, without GPU support (No CUDA required).
sudo apt-get install libopencv-dev python-opencv
| version: '2.2' | |
| services: | |
| elasticsearch: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:6.4.1 | |
| container_name: elasticsearch | |
| environment: | |
| - cluster.name=docker-cluster | |
| - bootstrap.memory_lock=true | |
| - "ES_JAVA_OPTS=-Xms512m -Xmx512m" | |
| ulimits: |
| %matplotlib inline | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| from sklearn.datasets.samples_generator import make_blobs | |
| class K_Means: | |
| def __init__(self, k=3, max_iterations = 500): | |
| self.k = k |
| /** | |
| * Lightweight script to detect whether the browser is running in Private mode. | |
| * @returns {Promise<boolean>} | |
| * | |
| * Live demo: | |
| * @see https://output.jsbin.com/tazuwif | |
| * | |
| * This snippet uses Promises. If you want to run it in old browsers, polyfill it: | |
| * @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js | |
| * |
Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.
| from flask import abort, make_response, jsonify | |
| abort(make_response(jsonify(message="Message goes here"), 400)) |
| # You need to install scikit-learn: | |
| # sudo pip install scikit-learn | |
| # | |
| # Dataset: Polarity dataset v2.0 | |
| # http://www.cs.cornell.edu/people/pabo/movie-review-data/ | |
| # | |
| # Full discussion: | |
| # https://marcobonzanini.wordpress.com/2015/01/19/sentiment-analysis-with-python-and-scikit-learn |
| import threading | |
| # A thread-safe implementation of Singleton pattern | |
| # To be used as mixin or base class | |
| class Singleton(object): | |
| # use special name mangling for private class-level lock | |
| # we don't want a global lock for all the classes that use Singleton | |
| # each class should have its own lock to reduce locking contention | |
| __lock = threading.Lock() |
| """ | |
| This module provides a simple WSGI profiler middleware for finding | |
| bottlenecks in web application. It uses the profile or cProfile | |
| module to do the profiling and writes the stats to the stream provided | |
| To use, run `flask_profiler.py` instead of `app.py` | |
| see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/ | |
| and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling | |
| """ |