This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
net = models.vgg16(pretrained=True) | |
net.classifier[6] = nn.Linear(in_features=4096, out_features=2) | |
params_to_update = [] | |
update_param_names = ["classifier.6.weight", "classifier.6.bias"] | |
for name, param in net.named_parameters(): | |
if name in update_param_names: | |
param.requires_grad = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
params_to_update_1 = [] | |
params_to_update_2 = [] | |
params_to_update_3 = [] | |
update_param_names_1 = ['features'] | |
update_param_names_2 = ['classifier.0.weight', | |
'classifier.0.bias', | |
'classifier.3.weight', | |
'classifier.3.bias'] | |
update_param_names_3 = ['classifier.6.weight', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var outerWidth = 300; | |
var outerHeight = 250; | |
var rMin = 5; | |
var rMax = 20; | |
var xColumn = "sepal_length"; | |
var yColumn = "petal_length"; | |
var rColumn = "sepal_width"; | |
var colorColumn = "variety"; | |
var svg = d3.select("body").append("svg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var svgWidth = 600, svgHeight = 500; | |
var svg = d3.select("svg") | |
.attr("width", svgWidth) | |
.attr("height", svgHeight) | |
.attr("class", "svg-container"); | |
var line = svg.append("line") | |
.attr("x1", 100) | |
.attr("x2", 500) | |
.attr("y1", 50) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataset = [80, 100, 56, 120, 180, 30, 40, 120, 160]; | |
// var dataset = [1, 2, 3, 4, 5]; | |
var svgWidth = 500, svgHeight = 300, barPadding = 5; | |
var barWidth = (svgWidth / dataset.length); // 各バーの幅 | |
var svg = d3.select('svg') | |
.attr('width', svgWidth) | |
.attr('height', svgHeight); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataset = [80, 100, 56, 120, 180, 30, 40, 120, 160]; | |
var svgWidth = 500, svgHeight = 300, barPadding = 5; | |
var barWidth = (svgWidth / dataset.length); // 各バーの幅 | |
var svg = d3.select('svg') | |
.attr('width', svgWidth) | |
.attr('height', svgHeight); | |
var barChart = svg.selectAll('rect') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataset = [1, 2, 3, 4, 5, 6]; | |
d3.select('body') | |
.selectAll('p') | |
.data(dataset) // datasetを指定 | |
.enter() // 読み込む? | |
.append('p') | |
.text(function(dd) { return '(' + dd + ')'; }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d3.select('h1').style('color', 'red') | |
.attr('class', 'heading') | |
.text('Updated h1 tag'); | |
d3.select('body').append('p').text('First paragraph'); | |
d3.select('body').append('p').text('Second paragraph'); | |
d3.select('body').append('p').text('Third paragraph'); | |
d3.selectAll('p').style('color', 'blue'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:8.0-cudnn5-devel-ubuntu16.04 | |
RUN apt-get update | |
RUN apt-get install -y git wget curl emacs | |
# pyenv | |
ENV PYENV_ROOT $HOME/.pyenv | |
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH | |
ENV PYTHON_VERSION anaconda3-4.2.0 | |
RUN git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Train CIFAR10 with PyTorch.''' | |
from __future__ import print_function | |
import torch | |
import torch.nn as nn | |
import torch.optim as optim | |
import torch.backends.cudnn as cudnn | |
import torchvision | |
import torchvision.transforms as transforms |