Rock It 《ML》JupyterLab 【丙】Extension《三》

如果 JupyterLab 環境中有類似像

LibreOffice Draw

LibreOffice Draw 5.1.2.2

LibreOffice Draw(又稱Draw)是一個向量繪圖軟體,它是LibreOffice辦公軟體套裝的一部份。它的特色在於多樣的「接頭」形狀,可以用在多種不同的線條上,方便建築繪圖,以及流程圖上,與Microsoft Visio以及CorelDRAW等向量繪圖軟體功能類似,LibreOffice Draw也有若干桌上排版(DTP)軟體(如Microsoft Publisher以及Adobe InDesign)的特性,因此亦可以用來進行簡單的印刷品排版編輯與設計。

LibreOffice的使用者也可安裝開放美工圖庫,這是一個巨大的畫廊,含有旗標、標誌、橫額,可用於一般簡報和製圖。LinuxDebianUbuntu已內含開放美工圖庫

 

這樣的繪圖軟體,豈不是很方便啊!

因此高興發現了

/jupyterlab-drawio

A standalone embedding of the FOSS drawio / mxgraph package into jupyterlab

jupyterlab-drawio

Binder with JupyterLab

A JupyterLab extension for standalone integration of drawio / mxgraph into jupyterlab.

Prerequisites

  • JupyterLab

Installation

jupyter labextension install jupyterlab-drawio

Usage

drawio-screencast

……

License

The files herein, and especially the source code of mxgraph, is licensed under the Apache 2.0 License. The copyright holders of draw.io / mxgraph is jgraph (http://www.jgraph.com). The original source code vendored in this package is taken from:https://github.com/jgraph/mxgraph

 

誰知『裡頭』之【File】選單不能用呢?

 

仔細盯著『動畫』瞧了好一會,

難到得用『外面』的【File】Menu 哩!

 

雖覺得奇怪耶??

一試之下,【Save Diagram】真能存檔也!!

 

而且【Export diagram as SVG】也 OK ☺

 

且先將就的用乎?!

 

 

 

 

 

 

 

Rock It 《ML》JupyterLab 【丙】Extension《二》下

終於可以正式介紹『擬態』了☆

Mimesis

Foreword

Advantages

This library offers a number of advantages over other similar libraries, such as Faker:

  • Performance. Significantly faster than other similar libraries.
  • Completeness. Strives to provide many detailed providers that offer a variety of data generators.
  • Simplicity. Does not require any modules other than the Python standard library.

……

Why octopus?

Basically, because octopuses are cool guys, but also because of the fantastic mimicry abilities of some families of octopuses. Have you ever hear about Thaumoctopus mimicus? Just read about that guy, because he is a really badass one.

What does name mean?

Mimesis (/maɪˈmiːsəs/; Ancient Greek: μίμησις (mīmēsis), from μιμεῖσθαι (mīmeisthai), “to imitate”, from μῖμος (mimos), “imitator, actor”) is a critical and philosophical term that carries a wide range of meanings, which include imitation, representation, mimicry, imitatio, receptivity, nonsensuous similarity, the act of resembling, the act of expression, and the presentation of the self.

What is the fake data?

Fake data is a kind of data which is used in software development.

That data looks like real data, but it is not.

What Mimesis is, What Mimesis is Not

The problem that Mimesis solves and solves it perfectly is generating data. When you need to populate database, create complex structured JSON/XML files, anonymize data taken from productive services then Mimesis is this is exactly what you need.

Mimesis is not object factory and it was not developed for using with specific database or ORM (such as Django ORM, SQLAclhemy etc.). It does not mean that you can’t use it with ORM on the contrary, this will be done very simply, this only means that possibly you’ll need third-party libraries to do it, like mimesis-factory or another one.

───

讀讀

Getting Started

Installation

Attention

Mimesis works only on Python 3.6 and higher. Developers have not plans related to adding support for old versions of Python.

………

玩玩之後︰

 

自知其中味乎☺

 

 

 

 

 

 

Rock It 《ML》JupyterLab 【丙】Extension《二》中

終究得面對 JupyterLab 延伸之安裝考察及測試驗證也◎

Other Requirements

Lantern relies on a handful of JupyterLab extensions to operate:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install plotlywidget
jupyter labextension install @jupyterlab/plotly-extension
jupyter labextension install jupyterlab_bokeh
jupyter labextension install qgrid
jupyter labextension install @jpmorganchase/perspective-jupyterlab

※ 太多 Deprecated warnning
jupyter labextension install ipysheet
jupyter labextension install lineup_widget

※ maybe not working

The following are for work in-progress on master:

jupyter labextension install bqplot

※ not yet

 

『大紅燈籠』高高卦,只是說明︰

『擬態』 Mimesis 3.1.0 已經走進 Python 3.6+ 天空裡。

或將暫時與此

Test data generation

Test data generation, an important part of software testing, is the process of creating a set of data for testing the adequacy of new or revised software applications. It may be the actual data that has been taken from previous operations or artificial data created for this purpose. Test Data Generation is seen to be a complex problem and though a lot of solutions have come forth most of them are limited to toy programs. The use of dynamic memory allocation in most of the code written in industry is the most severe problem that the Test Data Generators face as the usage of the software then becomes highly unpredictable, due to this it becomes harder to anticipate the paths that the program could take making it nearly impossible for the Test Data Generators to generate exhaustive Test Data. However, in the past decade significant progress has been made in tackling this problem better by the use of genetic algorithms and other analysis algorithms. Moreover, Software Testing is an important part of the Software Development Life Cycle and is basically labor-intensive. It also accounts for nearly one third of the cost of the system development. In this view the problem of generating quality test data quickly, efficiently and accurately is seen to be important.[1]

 

無緣乎?因期望時流回反,故而追跡

Release history

,尋求有無落腳之處!

mimesis 2.1.0

pip install mimesis==2.1.0

Project description

https://raw.githubusercontent.com/lk-geimfari/mimesis/master/media/logo_media.png


https://travis-ci.org/lk-geimfari/mimesis.svg?branch=master https://ci.appveyor.com/api/projects/status/chj8huslvn6vde18?svg=true https://readthedocs.org/projects/mimesis/badge/?version=latest https://codecov.io/gh/lk-geimfari/mimesis/branch/master/graph/badge.svg https://badge.fury.io/py/mimesis.svg https://img.shields.io/badge/python-3.5%2C%203.6-brightgreen.svg

Mimesis is a fast and easy to use library for Python programming language, which helps generate synthetic data for a variety of purposes in a variety of languages. This data can be particularly useful during software development and testing. For example, it could be used to populate a testing database, create beautiful JSON and XML files, anonymize data taken from a production service, etc.

This library offers a number of advantages over other similar libraries:

  • Performance. Significantly faster than other similar libraries.
  • Completeness. Strives to provide many detailed providers that offer a variety of data generators.
  • Simplicity. Does not require any modules other than the Python standard library.

sudo pip3 install mimesis==2.1.0

rock64@rock64:~$ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimesis
>>> from mimesis import Person
>>> person = Person('en')
>>> person.full_name()
'Bob Knowles'
>>>

 

或許天道和人世通常酬勤的呀◎

 

 

 

 

 

 

 

Rock It 《ML》JupyterLab 【丙】Extension《二》上

為了圖文並茂,故而想要 Jupyter 筆記本上的許多小工具呦☆

/jupyter-renderers

jupyter-renderers/packages/geojson-extension/

geojson-extension

A JupyterLab extension for rendering GeoJSON

demo

Requirements

  • JupyterLab ^0.30.0
  • Node.js >= 5

Install

sudo jupyter labextension install @jupyterlab/geojson-extension

 

誰知打算用『燈籠』

/lantern

Data exploration glue

Lantern

An orchestration layer for plots and tables, dummy datasets, widgets, research, reports, and anything else a data scientist might need.

Build Status GitHub issues Waffle.io codecov Gitter BCH compliance PyPI PyPI npm Docs

Note: Lantern Live has moved to tributary

Note: Email reports have moved to jupyterlab_email

Note: Publish is removed in favor of Voila

Install

To install the base package from pip:

pip install pylantern

To Install from source:

make install

To install the JupyterLab extension:

jupyter labextension install pylantern

or from source:

make labextension

To enable the Jupyter server extension:

jupyter serverextension enable --py lantern

Or run the corresponding commands directly

Lantern relies on JupyterLab extensions:

jupyter labextension install @jupyter-widgets/jupyterlab-manager
jupyter labextension install plotlywidget
jupyter labextension install @jupyterlab/plotly-extension
jupyter labextension install jupyterlab_bokeh
jupyter labextension install qgrid
jupyter labextension install @jpmorganchase/perspective-jupyterlab
jupyter labextension install ipysheet
jupyter labextension install lineup_widget

The following are for work in-progress on master:

jupyter labextension install bqplot

……

Getting Started

Read the docs!

Data

 

照亮前行之路

sudo pip3 install pylantern

卻遭遇麻煩也☻

rock64@rock64:~ipython3 Python 3.5.3 (default, Sep 27 2018, 17:25:39)  Type 'copyright', 'credits' or 'license' for more information IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.  In [1]: import lantern as l                                                      --------------------------------------------------------------------------- ImportError                               Traceback (most recent call last) /usr/lib/python3.5/tkinter/__init__.py in <module>      35 try: ---> 36     import _tkinter      37 except ImportError as msg:  ImportError: No module named '_tkinter'  During handling of the above exception, another exception occurred:  ImportError                               Traceback (most recent call last) <ipython-input-1-b3a41b239d6b> in <module> ----> 1 import lantern as l  /usr/local/lib/python3.5/dist-packages/lantern/__init__.py in <module> ----> 1 from .plotting import plot, figure       2 from .data import *       3 from .grids import grid       4 from .utils import download       5 from .extensions import *  /usr/local/lib/python3.5/dist-packages/lantern/plotting/__init__.py in <module>       1 from six import iteritems ----> 2 from .plot_matplotlib import MatplotlibPlot       3 from .plot_plotly import PlotlyPlot       4 from .plot_bokeh import BokehPlot       5 from ..utils import LanternException  /usr/local/lib/python3.5/dist-packages/lantern/plotting/plot_matplotlib.py in <module> ----> 1 import matplotlib.pyplot as plt       2 from .plotobj import BasePlot       3 from .plotutils import align_yaxis_np, get_color       4 from ..utils import in_ipynb       5   /usr/lib/python3/dist-packages/matplotlib/pyplot.py in <module>     113      114 from matplotlib.backends import pylab_setup --> 115 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()     116      117 _IP_REGISTERED = None  /usr/lib/python3/dist-packages/matplotlib/backends/__init__.py in pylab_setup()      30     # imports. 0 means only perform absolute imports.      31     backend_mod = __import__(backend_name, ---> 32                              globals(),locals(),[backend_name],0)      33       34     # Things we pull in from all backends  /usr/lib/python3/dist-packages/matplotlib/backends/backend_tkagg.py in <module>       4        5 import six ----> 6 from six.moves import tkinter as Tk       7 from six.moves import tkinter_filedialog as FileDialog       8   /usr/lib/python3/dist-packages/six.py in __get__(self, obj, tp)      90       91     def __get__(self, obj, tp): ---> 92         result = self._resolve()      93         setattr(obj, self.name, result)  # Invokes __set__.      94         try:  /usr/lib/python3/dist-packages/six.py in _resolve(self)     113      114     def _resolve(self): --> 115         return _import_module(self.mod)     116      117     def __getattr__(self, attr):  /usr/lib/python3/dist-packages/six.py in _import_module(name)      80 def _import_module(name):      81     """Import module, returning the module after the last dot.""" ---> 82     __import__(name)      83     return sys.modules[name]      84   /usr/lib/python3.5/tkinter/__init__.py in <module>      36     import _tkinter      37 except ImportError as msg: ---> 38     raise ImportError(str(msg) + ', please install the python3-tk package')      39 TclError = _tkinter.TclError      40 from tkinter.constants import *  ImportError: No module named '_tkinter', please install the python3-tk package </pre>    <span style="color: #666699;">過了一關</span>  <span style="color: #ff9900;">sudo apt-get install python3-tk</span>  <span style="color: #666699;">又來一關☻</span> <pre class="lang:default decode:true ">rock64@rock64:~ ipython3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import lantern as l                                                     
Traceback (most recent call last):

  File "/usr/local/lib/python3.5/dist-packages/IPython/core/interactiveshell.py", line 3267, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)

  File "<ipython-input-1-b3a41b239d6b>", line 1, in <module>
    import lantern as l

  File "/usr/local/lib/python3.5/dist-packages/lantern/__init__.py", line 2, in <module>
    from .data import *

  File "/usr/local/lib/python3.5/dist-packages/lantern/data/__init__.py", line 3, in <module>
    from .other import person, people, company, companies, ticker, currency, trades, superstore

  File "/usr/local/lib/python3.5/dist-packages/lantern/data/other.py", line 4, in <module>
    import mimesis

  File "/usr/local/lib/python3.5/dist-packages/mimesis/__init__.py", line 10, in <module>
    from mimesis.providers import *

  File "/usr/local/lib/python3.5/dist-packages/mimesis/providers/__init__.py", line 5, in <module>
    from mimesis.providers.base import BaseProvider, BaseDataProvider

  File "/usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py", line 84
    self._data: Dict[str, Any] = {}
              ^
SyntaxError: invalid syntax

 

當真關關難過,關關過耶?☻

/mimesis

Mimesis is fast and extremely easy to use Python package, which helps generate big volumes of fake data for a variety of purposes in a variety of languages. https://mimesis.name/

Mimesis – Fake Data Generator

https://raw.githubusercontent.com/lk-geimfari/mimesis/master/media/readme-logo.png

Description

Travi CI AppVeyor CI Documentation Status Code Coverage Package version Python version

Mimesis is fast and extremely easy to use Python package, which helps generate big volumes of fake data for a variety of purposes in a variety of languages. The fake data can be particularly useful during software development and testing. For example, it could be used to populate a testing database, create beautiful JSON and XML files, anonymize data taken from a production service and etc.

……

typingSupport for type hints

New in version 3.5.

Source code: Lib/typing.py

Note

The typing module has been included in the standard library on a provisional basis. New features might be added and API may change even between minor releases if deemed necessary by the core developers.


This module supports type hints as specified by PEP 484 and PEP 526. The most fundamental support consists of the types Any, Union, Tuple, Callable, TypeVar, and Generic. For full specification please see PEP 484. For a simplified introduction to type hints see PEP 483.

The function below takes and returns a string and is annotated as follows:

def greeting(name: str) -> str:
    return 'Hello ' + name

In the function greeting, the argument name is expected to be of type str and the return type str. Subtypes are accepted as arguments.

………

 

大膽闖關改☺!

     檔案: /usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py     


    def __init__(self, locale: str = locales.DEFAULT_LOCALE,
                 seed: Seed = None) -> None:
        """Initialize attributes for data providers.

        :param locale: Current locale.
        :param seed: Seed to all the random functions.
        """
        super().__init__(seed=seed)
        self._data: Dict[str, Any] = {}
        self._datafile = ''
        self._setup_locale(locale)
        self._data_dir = Path(__file__).parent.parent.joinpath('data')

    def _setup_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
        """Set up locale after pre-check.

        :param str locale: Locale
        :raises UnsupportedLocale: When locale is not supported.

 

self._data = {} # type is dict(str,any)

檔案: /usr/local/lib/python3.5/dist-packages/mimesis/providers/base.py    已更動


    def __init__(self, locale: str = locales.DEFAULT_LOCALE,
                 seed: Seed = None) -> None:
        """Initialize attributes for data providers.

        :param locale: Current locale.
        :param seed: Seed to all the random functions.
        """
        super().__init__(seed=seed)
        self._data = {} # type is dict(str,any)
        self._datafile = ''
        self._setup_locale(locale)
        self._data_dir = Path(__file__).parent.parent.joinpath('data')

    def _setup_locale(self, locale: str = locales.DEFAULT_LOCALE) -> None:
        """Set up locale after pre-check.

        :param str locale: Locale
        :raises UnsupportedLocale: When locale is not supported.

 

果然沒有盡頭,天不從人願乎?★

rock64@rock64:~ipython3 Python 3.5.3 (default, Sep 27 2018, 17:25:39)  Type 'copyright', 'credits' or 'license' for more information IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.  In [1]: import lantern as l                                                      --------------------------------------------------------------------------- ImportError                               Traceback (most recent call last) <ipython-input-1-b3a41b239d6b> in <module> ----> 1 import lantern as l  /usr/local/lib/python3.5/dist-packages/lantern/__init__.py in <module>       1 from .plotting import plot, figure ----> 2 from .data import *       3 from .grids import grid       4 from .utils import download       5 from .extensions import *  /usr/local/lib/python3.5/dist-packages/lantern/data/__init__.py in <module>       1 from .data_cufflinks import getCFData       2 from .data_sklearn import getSKData ----> 3 from .other import person, people, company, companies, ticker, currency, trades, superstore       4        5 # scikit learn  /usr/local/lib/python3.5/dist-packages/lantern/data/other.py in <module>       2 import pandas as pd       3 import string ----> 4 import mimesis       5 import finance_enums       6 from faker import Faker  /usr/local/lib/python3.5/dist-packages/mimesis/__init__.py in <module>       8 """       9  ---> 10 from mimesis.providers import *      11       12 __all__ = [  /usr/local/lib/python3.5/dist-packages/mimesis/providers/__init__.py in <module>       8 from mimesis.providers.choice import Choice       9 from mimesis.providers.clothing import Clothing ---> 10 from mimesis.providers.cryptographic import Cryptographic      11 from mimesis.providers.code import Code      12 from mimesis.providers.date import Datetime  /usr/local/lib/python3.5/dist-packages/mimesis/providers/cryptographic.py in <module>       4        5 import hashlib ----> 6 import secrets       7 import uuid       8   ImportError: No module named 'secrets' </pre>    <span style="color: #666699;">奮力再跳!</span> <h1 class="public "><span style="color: #808080;"><span class="author"><a class="url fn" style="color: #808080;" href="https://github.com/scaleway" rel="author" data-hovercard-type="organization" data-hovercard-url="/orgs/scaleway/hovercard">scaleway</a></span><span class="path-divider">/</span><strong><a style="color: #808080;" href="https://github.com/scaleway/python2-secrets" data-pjax="#js-repo-pjax-container">python2-secrets</a></strong></span></h1> <span style="color: #808080;"><span class="text-gray-dark mr-2">Backport python3.6 secrets to python2 </span><a style="color: #808080;" href="https://pypi.org/project/python2-secrets/" rel="nofollow">https://pypi.org/project/python2-secr…</a></span> <h1><span style="color: #ff9900;">Secrets backport</span></h1> <span style="color: #ff9900;">Backport of Python 3.6's <a style="color: #ff9900;" href="https://docs.python.org/3/library/secrets.html" rel="nofollow">secrets</a> module for Python 2.7, 3.4 and 3.5.</span>    <pre class="lang:default decode:true ">rock64@rock64:~ git clone https://github.com/scaleway/python2-secrets
Cloning into 'python2-secrets'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 84 (delta 6), reused 13 (delta 5), pack-reused 66
Unpacking objects: 100% (84/84), done.
rock64@rock64:~cd python2-secrets/ rock64@rock64:~/python2-secrets sudo python3 setup.py install
running install
running bdist_egg
running egg_info
creating python2_secrets.egg-info
writing python2_secrets.egg-info/PKG-INFO
writing top-level names to python2_secrets.egg-info/top_level.txt
writing dependency_links to python2_secrets.egg-info/dependency_links.txt
writing manifest file 'python2_secrets.egg-info/SOURCES.txt'
reading manifest file 'python2_secrets.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python2_secrets.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-aarch64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/secrets
copying secrets/secrets.py -> build/lib/secrets
copying secrets/__init__.py -> build/lib/secrets
creating build/bdist.linux-aarch64
creating build/bdist.linux-aarch64/egg
creating build/bdist.linux-aarch64/egg/secrets
copying build/lib/secrets/secrets.py -> build/bdist.linux-aarch64/egg/secrets
copying build/lib/secrets/__init__.py -> build/bdist.linux-aarch64/egg/secrets
byte-compiling build/bdist.linux-aarch64/egg/secrets/secrets.py to secrets.cpython-35.pyc
byte-compiling build/bdist.linux-aarch64/egg/secrets/__init__.py to __init__.cpython-35.pyc
creating build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/PKG-INFO -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/SOURCES.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/dependency_links.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
copying python2_secrets.egg-info/top_level.txt -> build/bdist.linux-aarch64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/python2_secrets-1.0.6-py3.5.egg' and adding 'build/bdist.linux-aarch64/egg' to it
removing 'build/bdist.linux-aarch64/egg' (and everything under it)
Processing python2_secrets-1.0.6-py3.5.egg
Copying python2_secrets-1.0.6-py3.5.egg to /usr/local/lib/python3.5/dist-packages
Adding python2-secrets 1.0.6 to easy-install.pth file

Installed /usr/local/lib/python3.5/dist-packages/python2_secrets-1.0.6-py3.5.egg
Processing dependencies for python2-secrets==1.0.6
Finished processing dependencies for python2-secrets==1.0.6

 

哪知道燈籠找到沒?

rock64@rock64:~$ ipython3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import lantern as l                                                     

In [2]:

 

 

 

 

 

 

 

Rock It 《ML》JupyterLab 【丙】Extension《一》

一個好軟件能方便日常事務,所以此處先介紹

/jupyterlab-toc

jupyterlab-toc

A Table of Contents extension for JupyterLab. This auto-generates a table of contents in the left area when you have a notebook or markdown document open. The entries are clickable, and scroll the document to the heading in question.

Here is an animation showing the extension’s use, with a notebook from the Python Data Science Handbook: Table of Contents

Prerequisites

  • JupyterLab v0.35

Installation

sudo jupyter labextension install @jupyterlab/toc

 

自動 TOC 生成工具。如是無論

閱讀、寫文章、測試程式、思考演算法…

能更稱心也。

【預設】不打開任何開關

 

】打開

 

】打開

 

 + 】同時打開

………

 

卻不知『』 Show Tags Menu 是什麼東東哩?

 

推敲其名,或指的是

/jupyterlab-celltags

A JupyterLab extension for notebook cell tags

jupyterlab-celltags

Binder

The JupyterLab cell tags extension enables users to easily add, view, and manipulate descriptive tags for notebook cells. The extension includes the functionality to select all cells with a given tag, supporting the performance of any operation on those cells.

Prerequisites

  • JupyterLab

Install

sudo jupyter labextension install @jupyterlab/celltags

 

後經驗證,概無疑矣。

點選『jupyterlab cell inspector』,

新增『bookmark』cell tag

 

點選【bookmark】,接著按  Filter

【預覽】,跳躍︰

 

【清除】,還原【Clear All】︰