CREATING ROUND SWING BUTTONS 2

Cortex-R52处理器比较器逻辑与DCLS配置解析 嵌入式处理器中的容错设计是确保系统可靠性的关键技术,其中双核锁步(DCLS)架构通过硬件比较器实现执行结果实时校验。Cortex-R52系列处理器提供三种配置模式:无冗余逻辑、锁步模式和分锁模式,分别对应不同的可靠性需求和功耗表现。锁步模式通过每个时钟周期的全量比较实现最高安全等级,适用于汽车电子等关键领域;分锁模式则兼顾灵活性和可靠性,适合工业控制场景。理解比较器逻辑的工作原理和配置方法,对开发高可靠性嵌入式系统至关重要,特别是在需要满足ISO 26262等安全认证要求的应用中。 阅读详情
CREATING ROUND SWING BUTTONS

This tip is about round Swing buttons. Actually, the information in
this tip applies to a button of any arbitrary shape but to keep the
discussion simple, we're just going to use a round shape.

There are two things you need to do when creating a round button. 
The first is to override the appropriate painting methods in order
to paint the round shape. The second is to set things up so that
the button responds only when you click within the round button
(not just within the rectangle that contains the round button).

Here's an example program that implements a round button.

import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;

public class RoundButton extends JButton {
    public RoundButton(String label) {
        super(label);

        // These statements enlarge the button so that it
        // becomes a circle rather than an oval.
        Dimension size = getPreferredSize();
        size.width = size.height = Math.max(size.width, size.height);
        setPreferredSize(size);

        // This call causes the JButton not to paint the background.
        // This allows us to paint a round background.
        setContentAreaFilled(false);
    }

    // Paint the round background and label.
    protected void paintComponent(Graphics g) {
if (getModel().isArmed()) {
            // You might want to make the highlight color
            // a property of the RoundButton class.
            g.setColor(Color.lightGray);
        } else {
            g.setColor(getBackground());
        }
g.fillOval(0, 0, getSize().width-1, getSize().height-1);

        // This call will paint the label and the focus rectangle.
super.paintComponent(g);
    }

    // Paint the border of the button using a simple stroke.
    protected void paintBorder(Graphics g) {
        g.setColor(getForeground());
        g.drawOval(0, 0, getSize().width-1, getSize().height-1);
    }

    // Hit detection.
    Shape shape;
    public boolean contains(int x, int y) {
        // If the button has changed size, make a new shape object.
        if (shape == null || !shape.getBounds().equals(getBounds())) {
            shape = new Ellipse2D.Float(0, 0, getWidth(), getHeight());
        }
        return shape.contains(x, y);
    }

    // Test routine.
    public static void main(String[] args) {
        // Create a button with the label "Jackpot".
        JButton button = new RoundButton("Jackpot");
        button.setBackground(Color.green);

        // Create a frame in which to show the button.
        JFrame frame = new JFrame();
        frame.getContentPane().setBackground(Color.yellow);
        frame.getContentPane().add(button);
        frame.getContentPane().setLayout(new FlowLayout());
        frame.setSize(150, 150);
        frame.setVisible(true);
    }
}


The RoundButton class extends JButton because we want to keep most
of functionality of a JButton. In the RoundButton constructor, the
method setContentAreaFilled() is called. This causes the button to
paint the focus rectangle, but not to paint the background.

Now we need to paint the circular background. That's done by
overriding the paintComponent() method. That method uses
Graphics.fillOval() to paint a solid circle. Then paintComponent()
calls super.paintComponent() to paint the label on top of the solid
circle.

This example also overrides paintBorder() in order to paint a border
around the round button. If you don't want a border, you would not
override this method. This method calls Graphics.drawOval() to
paint a thin border around the circle.

Finally, we want the button to respond only when the user clicks on
it, but not respond to clicks outside of it. By default, a JButton
responds to mouse clicks in a rectangular area around the
button. A JButton has no idea about the real shape of the button,
and so it just assumes that the button is rectangular. To tell
JButton the real shape of a button you need to override the
contains() method. The contains() method takes a coordinate and
returns true if the coordinate is inside the button and false
otherwise. The method uses a Shape object (Ellipse2D) to determine
whether the coordinate is inside the circle.

Note: In JDK 1.2.2, there's a small bug in how JButton behaves when
you drag the mouse in and out of its perimeter. Ideally, if you
clickon the circular button and then drag the mouse outside of the
button's perimeter, the button should change its appearance. When
you drag the mouse back into the circular button's perimeter, the
button should restore its appearance. Unfortunately, the code that
implements this behavior does not call the contains() method.
Instead it just uses the "bounds" of the button (this is the
smallest rectangular area containing the button). Notice that if
you drag the mouse slightly beyond the circular perimeter, that is,
outside of the circle but not outside the bounds, the button won't
change it's appearance. There is no workaround for this minor bug
except to implement all of the functionality yourself.


FORMATTING BIGDECIMAL NUMBERS

Floating and double precision variables are fine for doing
statistical or graphics-related calculations. However they are not
recommended forfinancial calculations. That's because the results
produced by floating and double precision arithmetic are not always
precise.  For example, the following example subtracts 1.1 from 2
using floating point numbers.

        double f = 2.9 - 1.1;
        System.out.println( f );

It produces the result 1.7999999999999998 rather than 1.8.

If this kind of result is unacceptable in your application, as is
the case with most financial applications, you should use BigDecimal
numbers instead of floating point numbers.  Here's a quick example
of using BigDecimal numbers.


import java.math.*;

class BigDecimalTest {
    public static void main(String[] args) {
        BigDecimal a = new BigDecimal("2.9");
        BigDecimal b = new BigDecimal("1.1");
        BigDecimal c = a.subtract(b);
        System.out.println(c);    // 1.8
    }
}


One of the features missing from the BigDecimal class is formatting
methods. When you print a BigDecimal number, all the digits are
printed (e.g. 12.3456000). This isn't what you want if you have to
print a value in dollar and cents format, for example (12.35).
Formatting features might be added in a later release but in the
meantime, here are some quick routines to perform the two most
common operations: stripping trailing zeroes and displaying with a
specified precision.


class FormatBigDecimal {
    // Returns the BigDecimal value n with trailing zeroes removed.
    static BigDecimal trim(BigDecimal n) {
        try {
            while (true) {
                n = n.setScale(n.scale()-1);
            }
        } catch (ArithmeticException e) {
            // no more trailing zeroes so exit.
        }
        return n;
    }

    // Returns the BigDecimal value n with exactly 'prec' decimal places.
    // Zeroes are padded to the right of the decimal point if necessary.
    static BigDecimal format(BigDecimal n, int prec) {
        return n.setScale(prec, BigDecimal.ROUND_HALF_UP);
    }

    // Some examples.
    public static void main(String[] args) {
        System.out.println(trim(new BigDecimal("12.3230000")));    // 12.323
        System.out.println(format(new BigDecimal("12.32534"), 2)); // 12.33
        System.out.println(format(new BigDecimal("12"), 2));       // 12.00
    }
}


The trim() method attempts to eliminate the last digit from the
number. If the digit is zero, it attempts to eliminate another.
If it tries to eliminate a non-zero digit, setScale() throws an
exception, and the method returns the result.

The trim() method does not use exceptions in a proper way. You
should only use exceptions for exceptional cases and not for
breaking out of loops as it is done here. However, this technique
is currently the most efficient way to implement this functionality.
(If you do use this method, you have to promise to correct it when
a better way comes along!)

The format() method simply returns a version of the BigDecimal
number with the scale of the number set to the specified precision.
It rounds the number such that 5's or greater are rounded up and
4's or lesser are rounded down.

.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .

- NOTE
The names on the JDC mailing list are used for internal Sun
Microsystems(tm) purposes only.  To remove your name from the list,
see Subscribe/Unsubscribe below.


- FEEDBACK
Comments?  Send your feedback on the JDC Tech Tips to:

jdc-webmaster


- SUBSCRIBE/UNSUBSCRIBE
The JDC Tech Tips are sent to you because you elected to subscribe
when you registered as a JDC member.  To unsubscribe from JDC Email,
go to the following address and enter the email address you wish to
remove from the mailing list:

http://developer.java.sun.com/unsubscribe.html


To become a JDC member and subscribe to this newsletter go to:

http://java.sun.com/jdc/


- ARCHIVES
You'll find the JDC Tech Tips archives at:

http://developer.java.sun.com/developer/TechTips/index.html


- COPYRIGHT
Copyright 1999 Sun Microsystems, Inc. All rights reserved.
901 San Antonio Road, Palo Alto, California 94303 USA.

This document is protected by copyright.  For more information, see:

http://developer.java.sun.com/developer/copyright.html


This issue of the JDC Tech Tips is written by Patrick Chan,
the author of the publication "The Java(tm) Developers Almanac"
(http://java.sun.com/docs/books/almanac/index.html).

JDC Tech Tips
August 26, 1999
避坑指南:CST粒子工作室Track Solver常见的5个参数设置错误 本文深入剖析了CST粒子工作室中Track Solver在电子枪仿真时常见的5个关键参数设置错误,包括空间电荷模型选择、发射源定义、材料边界处理、监视器配置及求解器稳定性设置。通过对比错误与正确做法,帮助用户避开陷阱,确保粒子追踪仿真的物理准确性与数值稳定性,从而获得更精准的电子枪仿真结果。 阅读详情

相关推荐

MQTT与物联网平台(一):基础知识和设备接入物联网平台的实现(以华为云为例)

本文简单介绍了MQTT的基础知识和使用方法,以蓝牙WIFI双模芯片W801作为硬件设备,接入到华为云。

weixin_50622833的博客 1万+

TWo buttons

***TWo buttons*** 薇尔莉特在一个机器前,有一个红色按钮、一个蓝色按钮和一个只能显示正整数的屏幕。按下红色按钮后,机器的数字会乘 2。按下蓝色按钮后,机器的数字会减 1。如果在某时刻,数字不再是正整数,机器会当场宕机,因此不能让数字小于或等于零。屏幕可以显示任意大的正整数。 初始状态下,机器的数字为 n。薇尔莉特想要在显示屏幕上得到数字为 m。为了获得这个结果,她最少需要...

weixin_44824383的博客 360

保姆级教程:用YOLOv5s搞定钢材表面缺陷检测,从数据集NEU-DET到模型部署全流程

本文提供了一份详细的YOLOv5s钢材表面缺陷检测教程,涵盖从NEU-DET数据集处理到模型部署的全流程。针对工业环境中的实际限制,如计算资源有限和标注样本少等问题,提供了优化方案和实用技巧,帮助开发者快速实现高效的钢材缺陷检测系统。

weixin_30568591的博客 469

2019湖南省赛 4 Buttons(推公式)

4 Buttons Bobo lives in an infinite chessboard. Initially he locates at (0,0)(0, 0)(0,0). There are 444 buttons. When the first button is pressed, Bobo moves right for at most aaa cells. When the seco...

tomjobs的博客 858

CCD 技术介绍(基于innovus引擎CCOpt)

CCD:全称是,并行优化clock和data path。CCOpt:全称是Clock的timing分为两种模式,和。preCTS并没有clock,因此需要建立一个,从clock端口到寄存器CK端的来自sdc中的设置;postCTSupdateIO latency,clock就会自动的转换成propagatedclock,这时就是实际时钟互连线网络的delay。在实际设计中,clock起始于ideal。

m0_61003348的博客 8980

STC8H DMA 串口1全双工中断方式收发通讯C语言

串口1全双工中断方式收发通讯程序。 通过PC向MCU发送数据, MCU将收到的数据自动存入DMA空间. 当DMA空间存满设置大小的内容后,通过串口1的DMA自动发送功能把存储空间的数据原样返回. 用定时器做波特率发生器,建议使用1T模式(除非低波特率用12T),并选择可被波特率整除的时钟频率,以提高精度。

czhaii的专栏 1468

Glyph 26426 missing from current font.解决matplotlib画图中文字体乱码问题

1. 问题复现 环境:Ipython 3.8 import matplotlib.pyplot as plt import pandas as pd data = pd.read_csv('/Users/me/Documents/small_cust.csv') data['first_catg'].value_counts().plot() plt.show() 图是画出来了...

fwj_ntu的博客 5万+

Multisim14.0仿真应用设计(三十九)74LS183 高速全加器应用仿真

74LS183是一种高速全加器,可以同时执行四位二进制数的加法运算。它的输入端包括两个4位二进制数和一个进位信号,输出端则为一个4位二进制数和一个进位信号。

zhusl6688的博客 3858

洛谷4965 薇尔莉特的打字机(Trie,DP)

神仙题。 考虑在一棵 Trie 上进行染色,将可能出现的串的末尾染成黑色。答案就是黑点的个数。一开始只有 \(A\) 的末尾点是黑色。 当出现一个字符(不是退格)\(c\) 时,就要将每个黑点的 \(c\) 儿子都染成黑色。 然而这样一个点可能会有重复染色,不能直接乘 \(2\)。 不妨记录一个 \(f[c]\) 表示有儿子 \(c\) 且该儿子是黑色的点的个数。 那么此时答案 \(an...

angzuo8655的博客 697

CosyVoice语音合成使用教程

CosyVoice是一款开源的语音合成工具,它基于深度学习模型,能够生成高度逼真的语音内容。该工具支持多种语言的语音生成,包括中文、英文、日文、粤语和韩语。CosyVoice的亮点在于它对生成语音情感和韵律的精细控制,通过富文本或自然语言输入,可以显著提升合成语音的情感表达能力。CosyVoice提供了多种预训练模型,用户可以根据需求选择合适的模型。:基底模型,适用于一般语音合成任务。:经过SFT微调的模型,适用于特定音色和情感的语音合成。:支持Instruct微调的模型,适用于自然语言控制的语音合成。

笔者从事电信媒体开发多年,愿意将多年的开发经验分享给同行 4445

coze 的插件输入飞书多维表格 app_token 后一直显示错误,如何解决?

🏆本文收录于《优快云问答解惑-专业版》专栏,主要记录项目实战过程中的Bug之前因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家关注&&收藏&&订阅!持续更新中,up!up!up!!

**My Coding Family** 2670

CREATING ROUND SWING BUTTONS 2 (转)

CREATING ROUND SWING BUTTONS 2 (转)[@more@]CREATING ROUND swing BUTTONSThis tip is about round Swing buttons. Actua...

csd3176的博客 103

手把手教你学Simulink——基于Simulink的扰动观测器(DOB)抗摩擦控制

摘要:本文介绍了基于Simulink的扰动观测器(DOB)抗摩擦控制方法。针对伺服系统中的摩擦非线性问题,首先建立了含Stribeck摩擦模型的电机系统动力学方程,然后设计了将摩擦视为总扰动的DOB结构。详细说明了Simulink建模步骤:搭建含摩擦电机模型、实现DOB、设计反馈控制器和信号合成。通过低速匀速运动和微小位置阶跃两种测试场景的仿真对比,验证了DOB在抑制爬行现象和提高定位精度方面的显著效果。文章还总结了DOB设计要点,与其他抗摩擦方法进行了对比,并给出了实践建议。该方法适用于机器人、数控机床等

MHD0815的博客 216

创建圆形的SWING BUTTON

CREATING ROUND SWING BUTTONSThis tip is about round Swing buttons. Actually, the information in this tip applies to a button of any arbitrary shape but to keep the discussion simple, were just go

programlover的专栏 994

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

创建圆形的SWING BUTTON (转)

创建圆形的SWING BUTTON (转)[@more@]CREATING ROUND swing BUTTONS This tip is about round Swing buttons. Actually, the...

csd3176的博客 185

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

一个很久以前写的 Cool Buttons 脚本

很久前写了一个Cool Buttons! 脚本,可以把页面当中的所有 input type="button" 和 reset / submit 按钮用自定义的样式替换,包含了一些动态效果。看在无忧脚本下载量有了一千多,就放在自己的blog 上吧现在注重web标准,我已经不用它了,也停止了开发。

melopia 887

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

The Science of JavaTM Sound Technology

  The Science of JavaTM Sound TechnologyBy Michael D. Meloan(June 1999) Sound creates mood, triggers memories, and in conjunction with visual imagery weaves whole worlds of fantasy. Sound is t

CanFly的专栏 2653

jar-The Java Archive Tool

jar-The Java Archive ToolCombines multiple files into a single JAR archive file. SYNOPSISjar [ options ] [manifest] destination input-file [input-files]DESCRIPTIONThe jar tool is a java

CanFly的专栏 1786

Compressing and Decompressing Data using JavaTM APIs

Compressing and Decompressing Data using JavaTM APIsby Qusay H. Mahmoud with contributions from Konstantin KladkoFebruary 2002 Many sources of information contain redundant data or data that adds

CanFly的专栏 1733

What's New in the JMF 2.0 Reference Implementations

   Whats New in the JMF 2.0 Reference Implementations New Features in JMF 2.1.1 FCS Improved RTP API Added support for H.263/1998 (RFC 2429) - now can interoperate with Darwin based RTSP

CanFly的专栏 1639

Drag and Drop: New Data Transfer Capabilities in the JavaTM 2 Platform, Standard Edition (J2SETM), version 1.4

New Data Transfer CapabilitiesJohn ZukowskiNovember 2001 Sun is currently undergoing their third beta release of the JavaTM 2 Platform, Standard Edition (J2SETM), version 1.4. This latest release

CanFly的专栏 1582

Distributed Java Programming with RMI and CORBA

Distributed Java Programming with RMI and CORBAQusay H. MahmoudJanuary 2002 The Java Remote Method Invocation (RMI) mechanism and the Common Object Request Broker Architecture (CORBA) are the two

CanFly的专栏 1464

New I/0 Functionality for JavaTM 2 Standard Edition 1.4

New I/0 Functionality for JavaTM 2 Standard Edition 1.4 John ZukowskiOctober, 2001Back in January 2000, while many people were arguing about whether the year 2000 was the last or first year of the

CanFly的专栏 1434

JINI NETWORK TECHNOLOGY DEFENDS THE ENVIRONMENT

JINITM NETWORK TECHNOLOGY DEFENDS THE ENVIRONMENT by Jon Byous November 8, 2001 -- Scientists at the U.S. Department of Energys Pacific Northwest National Laboratory (PNNL), in Richland,

CanFly的专栏 1335

NLEASHING J2EETM TECHNOLOGY'S POWER WITH EJBTM COMPONENTS

NLEASHING J2EETM TECHNOLOGYS POWER WITH EJBTM COMPONENTS by Michael Meloan March 20, 2001 -- The benefits of building ecommerce software applications from pretested, server-side JavaTM c

CanFly的专栏 1305

Understanding the Manifest

Understanding the Manifest JAR files can support a wide range of functionality, including electronic signing, version control, package sealing, extensions, and others. What gives JAR files the abi

CanFly的专栏 1271
上一篇: Lightweight UI Framework(有產生圓形Button的源碼)
下一篇: New I/0 Functionality for JavaTM 2 Standard Edition 1.4
CanFly
博客等级 码龄25年 0粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值