Git Product home page Git Product logo

visoptslider's Introduction

VisOpt Slider

Build Status GitHub PyPI

Qt-based implementation of VisOpt Slider widget [UIST 2014] for C++ & Python

Interactive exploration of a 3-dimensional Rosenbrock function

This repository provides

  1. a fully C++ implementation based on Qt5 and
  2. a fully Python implementation based on PySide2 (Qt5).

If your applications are based on Qt, it is quite easy to integrate a VisOpt Slider widget into your applications.

Features

VisOpt Slider is a GUI widget consisting of multiple sliders. It is specifically designed for interactive exploration of a high-dimensional scalar-valued function. It has the following special features.

Visualization

VisOpt Slider visualizes the values of the target function along with the sliders in the interface using a colormap.

Optimization

Not available yet. Please refer to the original paper (Koyama et al. 2014) and its extended version (Koyama et al. 2016).

For Python Users

Install

This package can be install via pip:

pip install visoptslider

By this, the dependencies (matplotlib, numpy, PySide2, and their dependencies) will be automatically installed together.

Python Example

from PySide2.QtWidgets import QApplication
import numpy as np
import visoptslider

if __name__ == "__main__":
    app = QApplication()

    # Define a target function
    num_dimensions = 3
    def target_function(x):
        return 1.0 - np.linalg.norm(x)

    # Define a target bound
    upper_bound = np.array([+1.0, +1.0, +1.0])
    lower_bound = np.array([-1.0, -1.0, -1.0])
    maximum_value = 1.0
    minimum_value = 0.0

    # Instantiate and initialize VisOpt Slider
    sliders_widget = visoptslider.SlidersWidget()
    sliders_widget.initialize(num_dimensions=num_dimensions,
                              target_function=target_function,
                              upper_bound=upper_bound,
                              lower_bound=lower_bound,
                              maximum_value=maximum_value,
                              minimum_value=minimum_value)

    # Show VisOpt Sliders
    sliders_widget.show()

    app.exec_()

See python_test/*.py for more detailed examples.

Python Versions

This package is targeted at Python 3.6+, but currently tested on 3.7 only.

For C++ Users

Build

This project is managed by using CMake. It can be built by the standard CMake cycle:

git clone https://github.com/yuki-koyama/visoptslider.git --recursive
mkdir build
cd build
cmake ../visoptslider
make

C++ Example

#include <QApplication>
#include <visoptslider/visoptslider.hpp>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    // Define a target function
    constexpr int num_dimensions = 3;
    constexpr auto target_function = [](const Eigen::VectorXd& x)
    {
        return 1.0 - x.norm();
    };

    // Define a target bound
    const Eigen::Vector3d upper_bound(+ 1.0, + 1.0, + 1.0);
    const Eigen::Vector3d lower_bound(- 1.0, - 1.0, - 1.0);
    constexpr double maximum_value = 1.0;
    constexpr double minimum_value = 0.0;

    // Instantiate and initialize VisOpt Slider
    visopt::SlidersWidget sliders_widget;
    sliders_widget.initialize(num_dimensions,
                              target_function,
                              upper_bound,
                              lower_bound,
                              maximum_value,
                              minimum_value);

    // Show VisOpt Slider
    sliders_widget.show();

    return app.exec();
}

See tests/*.cpp for more detailed examples.

Dependencies

Prerequisites

  • Eigen (e.g., brew install eigen / apt install libeigen3-dev)
  • Qt5 (e.g., brew install qt / apt install qt5-default)

Included as Submodules

References

License

MIT License.

Contributing

Issue reports, suggestions, requests, and PRs are highly welcomed.

Many features are currently missing; for example,

  • Interactive optimization functionality (Koyama et al. 2014)
  • Option to make colors de-saturated (Koyama et al. 2016)
  • Options for colormaps (currently, it always uses the viridis colormaps)
  • Options for slider directions (currently, it always uses horizontal sliders)
  • Tests for the Python package with various Python environments
  • Documentation

visoptslider's People

Contributors

yuki-koyama avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.