Utilities for interacting with the AI Squared Technology Stack
Project description
AISquared
This package contains utilities to interact with the AI Squared technology stack, particularly with developing and deploying models to the AI Squared Browser Extension or other applications developed through the AI Squared JavaScript SDK.
Installation
This package is available through Pypi and can be installed by running the following command:
pip install aisquared
Alternatively, the latest version of the software can be installed directly from GitHub using the following command
pip install git+https://github.com/AISquaredInc/aisquared
Capabilities
This package is currently in a state of constant development, so it is likely that breaking changes can be made at any time. We will work diligently to document changes and make stable releases in the future.
The aisquared
package currently contains five subpackages, the aisquared.config
package, the aisquared.base
subpackage, the aisquared.logging
subpackage, the aisquared.serving
subpackage, and the aisquared.remote
package. The config
package holds objects for building the configuration files that need to be included with converted model files for use within the AI Squared Extension. The contents of the config subpackage contain both pre- and postprocessing steps as well as harvesting, analytic, rendering, and feedback objects to use with the model. The following will explain the functionality of the config package:
aisquared.config
The aisquared.config
subpackage contains the following objects:
ModelConfiguration
- The
ModelConfiguration
object is the final object to be used to create the configuration file. It takes as input a list of harvesting steps, list of preprocessing steps, a list of analytics, a list of postprocessing steps, a list of rendering steps, an optional MLFlow URI, an optional MLFlow user, and an optional MLFlow token
- The
aisquared.config.harvesting
The aisquared.config.harvesting
subpackage contains the following objects:
ImageHarvester
- The
ImageHarvester
class indicates the harvesting of images within the DOM to perform prediction on
- The
TextHarvester
- The
TextHarvester
class indicates the harvesting of text within the DOM to perform prediction on
- The
aisquared.config.preprocessing
The aisquared.config.preprocessing
subpackage contains the following objects:
ImagePreprocessor
- The
ImagePreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for images.
- The
TabularPreprocessor
- The
TabularPreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for tabular data.
- The
TextPreprocessor
- The
TextPreprocessor
class takes in preprocessing steps (defined below) which define preprocessing steps for text data.
- The
aisquared.config.analytic
The aisquared.config.analytic
subpackage contains the following objects:
LocalAnalytic
- The
LocalAnalytic
class indicates the use of an analytic or lookup table from a local file
- The
LocalModel
- The
LocalModel
class indicates the use of a model from a local file
- The
DeployedAnalytic
- The
DeployedAnalytic
class indicates the use of an analytic or lookup table from a remote resource
- The
DeployedModel
- The
DeployedModel
class indicates the use of a model deployed to a remote resource
- The
aisquared.config.postprocessing
The aisquared.config.postprocessing
subpackage contains the following objects:
Regression
- The
Regression
object is a postprocessing class for models which perform regression. Since it is common to train regression models by scaling regression outputs to values between 0 and 1, this class is designed to convert output values between 0 and 1 to their original values, corresponding tomin
andmax
when the class is instantiated.
- The
BinaryClassification
- The
BinaryClassification
object is a postprocessing class for models which perform binary classification. The class is instantiated with a label map and a cutoff value used to identify when the positive class (class 1) is identified.
- The
MulticlassClassification
- The
MulticlassClassification
object is a postprocessing class for models which perform multiclass classification. The class is instantiated with a label map only.
- The
ObjectDetection
- The
ObjectDetection
object is a postprocessing class for models which perform object detection. The class is instantiated with a label map and a cutoff value for identification.
- The
aisquared.config.rendering
The aisquared.config.rendering
subpackage contains the following objects:
ImageRendering
- The
ImageRendering
object is a rendering class for rendering single predictions on images.
- The
ObjectRendering
- The
ObjectRendering
object is a rendering class for rendering object detection predictions on images.
- The
WordRendering
- The
WordRendering
object is a rendering class for rendering highlights, underlines, or badges on individual words.
- The
DocumentRendering
- The
DocumentRendering
object is a rendering class for rendering document predictions.
- The
aisquared.config.feedback
The aisquared.config.feedback
subpackage contains the following objects:
SimpleFeedback
- The
SimpleFeedback
object is a feedback object for simple thumbs up/thumbs down for predictions
- The
BinaryFeedback
- The
BinaryFeedback
object is a feedback object for binary classification use cases
- The
MulticlassFeedback
- The
MulticlassFeedback
object is a feedback object for multiclass classification use cases
- The
RegressionFeedback
- The
RegressionFeedback
object is a feedback object for regression use cases
- The
ModelFeedback
- The
ModelFeedback
object is a feedback object for configuring feedback for the model directly, rather than its predictions
- The
QualitativeFeedback
- The
QualitativeFeedback
object is a feedback object for configuring questions asked about each individual prediction the model makes
- The
Preprocessing Steps
The aisquared.config.preprocessing
subpackage contains PreProcStep
objects, which are then fed into the ImagePreprocessor
, TabularPreprocessor
, and TextPreprocessor
classes. The PreProcStep
classes are:
ZScore
- This class configures standard normalization procedures for tabular data
MinMax
- This class configures Min-Max scaling procedures for tabular data
OneHot
- This class configures One Hot encoding for columns of tabular data
AddValue
- This class configures adding values to pixels in image data
SubtractValue
- This class configures subtracting values to pixels in image data
MultiplyValue
- This class configures multiplying pixel values by a value in image data
DivideValue
- This class configures dividing pixel values by a value in image data
ConvertToColor
- This class configures converting images to the specified color scheme
Resize
- This class configures image resize procedures
Tokenize
- This class configures how text will be tokenized
RemoveCharacters
- This class configures which characters should be removed from text
ConvertToCase
- This class configures which case - upper or lower - text should be converted to
ConvertToVocabulary
- This class configures how text tokens should be converted to vocabulary integers
PadSequences
- This class configures how padding should occur given a sequence of text tokens converted to a sequence of integers
These step objects can then be placed within the TabularPreprocessor
, ImagePreprocessor
, or TextPreprocessor
objects. For the TabularPreprocessor
, the ZScore
, MinMax
, and OneHot
Steps are supported. For the ImagePreprocessor
, the AddValue
, SubtractValue
, MultiplyValue
, DivideValue
, ConvertToColor
, and Resize
Steps are supported. For the TextPreprocessor
, the Tokenize
, RemoveCharacters
, ConvertToCase
, ConvertToVocabulary
, and PadSequences
Steps are supported
Final Configuration and Model Creation
Once harvesting, preprocessing, analytic, postprocessing, and rendering objects have been created, these objects can then be passed to the aisquared.config.ModelConfiguration
class. This class utilizes the objects passed to it to build the entire model configuration automatically.
Once the ModelConfiguration
object has been created with the required parameters, the .compile()
method can be used to create a file with the .air
extension that can be loaded into an application which utilizes the AI Squared JavaScript SDK.
aisquared.base
The aisquared.base
subpackage contains two classes, the DocumentPredictor
and the ImagePredictor
classes, which streamline document prediction and image prediction using locally-saved models. These classes abstract away the steps required in the ModelConfiguration
class. However, just like the ModelConfiguration
class, objects of these classes support the .compile()
method; using this method creates the .air
file as well.
aisquared.remote
The aisquared.remote
subpackage contains utilities and classes for interacting with cloud-based resources for deploying and managing models and results. Currently, we have the following client objects:
AWSClient
- This client facilitates the interaction with AWS cloud storage
AzureClient
- This client facilitates the interaction with Azure cloud storage
aisquared.serving
The aisquared.serving
subpackage contains utilities for serving models locally or remotely using MLflow or locally using Flask.
aisquared.logging
The aisquared.logging
subpackage is powered by MLflow, a powerful open-source platform for the machine learning lifecycle. The logging
subpackage inherits nearly all functionality from mlflow, so we highly recommend users refer to the MLflow documentation site for additional information.
In this subpackage, we have additionally added implementations of individual functions to save TensorFlow, Keras, Scikit-Learn, and PyTorch models in a format that can be deployed quickly using MLflow.
Changes
Below are a list of additional features, bug fixes, and other changes made for each version.
Version 0.1.3
- Added
flags
parameter toTextHarvester
using regular expression harvesting - Deleted
model_feedback
parameter inModelConfiguration
object and included functionality infeedback_steps
parameter - Changed
format
parameter toheader
for both deployed analytics - Added feedback and stages to
DocumentPredictor
andImagePredictor
objects - Non-API changes for
ALLOWED_STAGES
- Fixed bugs preventing Windows users from importing the package
- Updated
ModelConfiguration
to includeurl
parameter - Changed default tokenization string
Version 0.2.0
- Moved preprocessing steps under subpackages for specific kinds of preprocessing steps
- Cleaned up documentation to render within programmatic access environments
- Added
aisquared.logging
subpackage - Created
InputHarvester
- Created the
aisquared.serving
subpackage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aisquared-0.2.0.dev1.tar.gz
.
File metadata
- Download URL: aisquared-0.2.0.dev1.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1e63aba058bdca5faf74198f4ad571bbe4c004bde2aae5bd8566c264d6c2bef1 |
|
MD5 | 24224e8f87c2ccecf67bcdd59c3b1eda |
|
BLAKE2b-256 | 2891a3f700c909745fb262abc0fb75401da088e07eb066ad1a848feb02fc5ace |
File details
Details for the file aisquared-0.2.0.dev1-py3-none-any.whl
.
File metadata
- Download URL: aisquared-0.2.0.dev1-py3-none-any.whl
- Upload date:
- Size: 117.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c181342645b4ed16356bd33dbae0ee848d6a885b9bc0f9afa662075d9aa9e7be |
|
MD5 | ff6cef2e59d6312bc9a2721379217654 |
|
BLAKE2b-256 | 8812e800fb11d83a073787d729602fa3026dd00a76529ea93e59b9bc36e51eb3 |