Comments (3)
@Paethon - the plotting functionality was designed to work in both notebooks and in standalone html files that we use for generating "reports" that can be easily shared - so yes, other modes are definitely supported. We highlight the notebook usage on the site because in our experience that's the primary way users have interacted with the tool for visualizing the models & results.
Here's an example of how one can run the CNN on MNIST tutorial and get the contour plot in an html file:
import torch
import numpy as np
from ax.plot.contour import plot_contour
from ax.plot.trace import optimization_trace_single_method
from ax.service.managed_loop import optimize
from ax.utils.tutorials.cnn_utils import load_mnist, train, evaluate
# note these new imports!
from ax.plot.render import plot_config_to_html
from ax.utils.report.render import render_report_elements
dtype = torch.float
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
train_loader, valid_loader, test_loader = load_mnist()
def train_evaluate(parameterization):
net = train(train_loader=train_loader, parameters=parameterization, dtype=dtype, device=device)
return evaluate(
net=net,
data_loader=valid_loader,
dtype=dtype,
device=device,
)
best_parameters, values, experiment, model = optimize(
parameters=[
{"name": "lr", "type": "range", "bounds": [1e-6, 0.4], "log_scale": True},
{"name": "momentum", "type": "range", "bounds": [0.0, 1.0]},
],
evaluation_function=train_evaluate,
objective_name='accuracy',
)
plot_config = plot_contour(model=model, param_x='lr', param_y='momentum', metric_name='accuracy')
# create an Ax report
with open('report.html', 'w') as outfile:
outfile.write(render_report_elements(
"example_report",
html_elements=[plot_config_to_html(plot_config)],
header=False,
))
We're working on making the plotting a bit more modular (and not always depend on require.js), which will make it even easier to put together a barebones html file without using the render_report_elements
that handles the dependency management for you. I should note that when using the report functionality, you get access to a couple other utilities that make it easy to compose reports for viewing of results (see, e.g., benchmarking reports)
Are there other ways of plotting that you had in mind, or does outputting an html file work for you?
from ax.
Thanks!
Generating an HTML report is actually the best solution for me anyway. I found plot_config_to_html(plot_config)
and tried writing that directly to an html-file, but that did not really work out as intended 😄
from ax.
Great - happy that works for you. Once we do the refactor of the plotting, it should be possible to write plot_config_to_html(plot_config)
directly to HTML file and for that to work. Issue now is that you need a bunch of dependencies in the HTML head in order for rendering to work.
from ax.
Related Issues (20)
- Error: A list of 'ChoiceParameter' is not iterable HOT 4
- [Bug] Generation Strategy equality check error without call to repr HOT 1
- ax.dev, GitHub readme, and loop tutorial examples are ignoring `minimize` kwarg HOT 2
- Get Started code gives the same result regardless of random seed HOT 3
- Trouble with searching documentation (Algolia, API docs, etc.), for example `get_next_trials` HOT 1
- Issue when starting an AxClient with out-of-design points HOT 2
- cannot import name 'TrainingData' HOT 2
- applying complex constrains HOT 2
- Ax is not not starting as many workers as I'd like to; sometimes, get_next_trials returns 0 new trials HOT 3
- Evaluating custom candidates HOT 2
- Input Feature Selection - Does the relevant code exist? HOT 6
- [Feature Request] support constraints on `ChoiceParameters` HOT 4
- Extending Models.THOMPSON with an extra parameter HOT 1
- There are some questions when i use the Ax HOT 6
- Space characters in the objective name AND specifying a threshold leads to an error message: "AssertionError: Outcome constraint should be of form `metric_name >= x" HOT 1
- Pandas deprecation warning when deserializing AxClient JSON HOT 2
- AX seems to get stuck with Ray
- `StandardizeY` transform requires non-empty data." when using SAASBO
- Plotting outside of a notebook HOT 1
- Setting search space step size in Ax Service API HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ax.