《Javascript & JQuery interactive front-end web development》 by Jon Duckette 读书笔记-未完待续

AI Agent工作流实战:LangGraph提升简历筛选效率40% AI Agent工作流正成为企业自动化转型的核心技术,其基于状态机的动态决策能力远超传统脚本。以LangGraph为代表的图计算框架,通过可视化节点编排和自动状态管理,显著提升复杂业务逻辑的开发效率。在简历筛选等典型场景中,结合异步处理与LLM智能决策,可实现处理速度从4小时到9分钟的突破性优化。本文通过对比LangChain等工具链,详解Python环境配置、性能调优及生产级部署方案,为开发者提供从理论到实践的完整指南。 阅读详情

There are many inconsistencies between browsers that affect JavaScript developers. jQuery will help you deal with cross-browser inconsistencies (it is one of the major reasons why jQuery rapidly gained popularity amongst web developers).

Computers use data to create models of things in the real world. The events, methods, and properties of an object all relate to each other: Events can trigger methods, and methods can retrieve or update an object's properties.

The browser represents each window or tab using a window object. The location property of the window object will tell you the URL of the current page.

The current web page loaded into each window is modelled using a document object.
The title property of the document object tells you what is between the opening <title> and closing </title> tag for that web page, and the lastModified property of the document object tells you the date this page was last updated.

Some statements are surrounded by curly braces; these are known as code blocks. The closing curly brace is not followed by a semicolon.

Unlike some other programming languages, when declaring a variable in JavaScript, you do not need to specify what type of data it will hold.

Quotes for string literals should be straight (not curly) quotes:

Because strings can live in single or double quotes, if you just want to use double quotes in the string, you could surround the entire string in single quotes. If you just want to use single quotes in the string, you could surround the string in double quotes.

A technique called escaping the quotation characters is done by using a backwards slash (or "backslash") before any type of quote mark that appears within a string. The backwards slash tells the interpreter that the following character is part of the string, rather than the end of it.

---------------------
// Write total into the element with i d of cost
/*a variable can be used to hold a reference to an element in the HTML page. This allows you to work directly with the element stored in that variable.*/
var el = document .getElementByld( ' cost');
el . textCont ent = '$' +total;
------------------
Variable name can contain letters, numbers, dollar sign ($), or an underscore (_). But, you must not use a dash (-) or a period (.) in a variable name.

The values in the array do not need to be the same data type, so you can store a string, a number and a Boolean all in the same array.

Rather than creating an array literal, an array can be created using a different technique called an array constructor. This uses the new keyword followed by Array(); the values are then specified in parentheses (not square brackets), and each value is separated by a comma. 
----------------
var colors = new Array('white', 
                       'black',
                       'custom');

alert(colors.length);//show how many elements are in an array;;length is a property, not a function, so do not add () after the keyword "length".

---------------------
An expression evaluates into (results in) a single value.
Technically, undefined is a data type like a number, string, or Boolean.
--------------
var score = 'seven';
var score2 = 'nine';
var total = score * score2;
alert(total);//NaN
--------------
Functions consist of a series of statements that have been grouped together because they perform a specific task. A method is the same as a function, except methods are created inside (and are part of) an object.

Programming languages often rely upon on name/value pairs. The function has a name and the value is the code block (which consists of statements). When you call the function by its name, those statements will run.
You can also have anonymous functions. They do not have a name, so they cannot be called. Instead, they are executed as soon as the interpreter comes across them.

The function acts like a store; it holds the statements that are contained in the curly braces until you are ready to use them. Those statements are not run until the function is called.

Sometimes you will see a function called before it has been declared. This still works because the interpreter runs through a script before executing each statement, so it will know that a function declaration appears later in the script.

-----------------

//Functions can return more than one value using an array.
    
function getSize (width, height, depth) {
    var area = width * height;
    var volume = width * height * depth;
    var sizes= [area , volume];
    return sizes;
}
var areaOne = getSize (3, 2, 3)[0];
console.log('areaOne is: ' + areaOne);
var volumeOne = getSize (3, 2, 3)[1];
console.log('volumeOne is: ' + volumeOne);
---------------
Expressions produce a value. They can be used where values are expected. If a function is placed where a browser expects to see an expression, (e.g., as an argument to a function), then it gets treated as an expression.
----------
/*If you put a function where the interpreter would expect to see an expression, then it is treated as an expression, and it is known as a function expression. In function expressions, the name is usually omitted. A function with no name is called an anonymous function. Below, the function is stored in a variable called area. It can be called like any function created with a function declaration.*/
var area = function(width, height) {
    return width * height;
};
var size = area(3, 4) ;
console.log('size is: ' + size);
-------------
/*The variable called area will hold the value returned from the function (rather than storing the function itself so that it can be called later).*/
var area =(function() {
    var width = 3;
    var height = 2;
    return width * height;
}());
console.log(area);
/*The final parentheses after the closing curly brace of the code block tell the interpreter to call the function immediately. The grouping operators are parentheses there to ensure the intrepreter treats this as an expression.
You may see the final parentheses in an IIFE placed after the closing grouping operator but it is commonly considered better practice to place the final parentheses before the closing grouping operator, as shown in the code above.
IIFEs are commonly used as a wrapper around a set of code. Any variables declared within that anonymous function are effectively protected from variables in other scripts that might have the same name.*/    
-------------
function getArea(width, height) {
    //a variable used without the var keyword, the variable will be treated as a global variable (this is considered bad practice).
    randomNum = 1;
    area = width * height;
    return area;
}

getArea(2,3);
var wallSize = getArea(3, 2);

console.log(wallSize);
console.log(randomNum);
--------------
If a variable is part of an object, it is called a property.
If a function is part of an object, it is called a method.
------------
You can also access the properties of an object (but not its methods) using square bracket syntax. This time the object name is followed by square brackets, and the property name is inside them. This notation is used most commonly used when the name of the property is a number (technically allowed, but should generally be avoided) or a variable is being used in place of the property name.
---------------
// Set up the object
var hotel = new Object();

hotel.name = 'Park';
hotel.rooms = 120;
hotel.booked = 77;
hotel.checkAvailability = function() {
  return this.rooms - this.booked;  
};

console.log(hotel.name, hotel.checkAvailability());

/*this syntax can be used to add properties and methods to any object you have created (no matter which notation you used to create it).
To create an empty object using literal notation use:
var hotel = {}
The curly brackets create an empty object.*/
-----------------
// Create the template for objects that are hotels
function Hotel(name, rooms, booked) {
  this.name = name;
  this.rooms = rooms;
  this.booked = booked;
  this.checkAvailability = function() {
    return this.rooms - this.booked;
  };
}


// Create two hotel objects
var quayHotel = new Hotel('Quay', 40, 25);
var parkHotel = new Hotel('Park', 120, 77);

console.log(quayHotel.name);
console.log(parkHotel.name);
-----------
/*When a function is created at the top level of a script (that is, not inside another object or function), then it is in the global scope or global context.
The default object in this context is the window object, so when this is used inside a function in the global context it refers to the window object.
Below, this is being used to return properties of the window object.
Under the hood, the this keyword is a reference to the object that the function is created inside.
*/

function windowSize() {
  var width = this.innerWidth;
  var height = this.innerHeight;
  return [height, width];
}
currentWindowSize=windowSize();
console.log(currentWindowSize);

------------------
/*All global variables also become properties of the window object, so when a function is in the global context, you can access global variables using the window object, as well as its other properties.
Here, the showWidth() function is in global scope, and this.width refers to the width variable*/

var width = 600 ; 
var shape = {width: 300};
var showWidth = function() {
    alert(this.width);
};
showWidth();
-----------------
/*When a function is defined inside an object, it becomes a method. In a method, this refers to the containing object.
In the example below, the getArea() method appears inside the shape object, so this refers to the shape object it is contained in*/
var shape = {
width : 600,
height : 400,
getArea : function() {
    return this.width * this.height;
//same as:    return shape.width * shape.height;
}
};

console.log(shape.getArea());
-----------------
/*The last but one line indicates that the showWidth() function is used as a method of the shape object. The method is given a different name: getWidth().
When the getWidth() method is called, even though it uses the showWidth() function, this now refers to the shape object, not the global context (and this.width refers to the width property of the shape object). So it writes a value of 300 to the page.*/

var width = 600;
var shape= {width : 300};
var showWidth = function () {
    alert(this.width);
};
shape.getWidth = showWidth;
shape.getWidth();//output 300

-------------------
Two pages back, it was noted that an array can hold a set of objects, or that the property of an object could be an array. It is also possible for the property of an object to be another object. When an object is nested inside another object, you may hear it referred to as a child object.
------------------
//The document object's lastModified property will tell you the date that the page was last updated
console.log(document.lastModified);
-------------
//The String object's toUpperCase() method makes all letters in the following variable uppercase.
var aString ="originally written in lowercase."

console.log(aString.toUpperCase());
----------------
console.log(Math.PI);
--------------
Child objects are stored as properties of their parent object. So dot notation is used to access them, just like you would access any other property of that object.
--------------
// Find the width of the browser window
window.innerWidth;
// Find the height of the browser window
window.innerHeight;
// Find the width of the computer screen
window.screen.width;
// Find the height of the computer screen
window.screen.height;
----------------
The window object's alert() method is used to create a dialog box shown on top of the page. It is known as an alert box. Although this is a method of the window object, you may see it used on its own (as shown here) because the window object is treated as the default object if none is specified.
-----------------
//title of current document
console.log(document.title);
//returns string contains URL of current document
console.log(document.URL);
//returns domains of current document
console.log(document.domain);
-------------
The HTML <hr> element represents a thematic break between paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section.
Historically, this has been presented as a horizontal rule or line. While it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate CSS.

it can be confusing to discover that a simple value (like a string, a number, or a Boolean) can have methods and properties. Under the hood, JavaScript treats every variable as an object in its own right.

Technically, functions are also objects. But they have an additional feature: they are callable, which means you can tell the interpreter when you want to execute the statements that it contains.
-------------
var randomNumber = 12.3456234567;
console.log(typeof(randomNumber));//number
console.log(randomNumber.toFixed(2));//12.35,a  string is returned, because fractions cannot always be accurately represented using floating point numbers.
console.log(typeof(randomNumber.toFixed(2)));//string
console.log(randomNumber.toPrecision(5));// 12.346
console.log(typeof(randomNumber.toPrecision(5)));// string
console.log(randomNumber.toExponential(2));//1.23e+1
console.log(typeof(randomNumber.toExponential(2)));//string
-------------------
//Math is known as a global object. 
console.log(Math.round(2.6));//round number to the nearest integer 3
console.log(Math.round(3.1));//round number to the nearest integer 3
console.log(Math.ceil(3.1));//round number up to the nearest integer 4
console.log(Math.floor(3.1));//round number down to the nearest integer 3
console.log(Math.random());//Generates a random number between 0 (inclusive) and 1(not inclusive).
----------------
// Create a variable to hold a random number between 1 and 10
/*Using the floor() method ensures that the number is always rounded down to the nearest integer, and you can then add 1 to ensure the number is between 1 and 10.*/
var randomNum = Math.floor((Math.random() * 10) + 1);
--------------
In JavaScript, dates are stored as a number: specifically the number of milliseconds since midnight on January 1, 1970.
---------------
// Create a variable to hold a new Date object (defaults to now)
var today = new Date();
var Day = today.getDate();//return the day of the month(1-31);
today.setDate(12);//set the day of the date
console.log(today.getDate());
console.log(today.toDateString());//return date as a human-readable string
console.log(today.toTimeString());//return time as a human-readable string
console.log(today.toString())//return date and time as a human-readable string
----------------
//set a date using the following string format
var aDateCreated = new Date('Apr 16, 1996 15:45:55');
-----------
Placing script inside an immediately invoked function expression helps protect the scope of variables.

Every value can be treated as true or false even if it is not a Boolean true or false value.

-----------------
var pass = 50;   // Pass mark
var score = 90;  // Score

// Check if the user has passed
var hasPassed = score >= pass;
console.log(hasPassed);//true
--------------
var aBooleanValue = true;
console.log(typeof(aBooleanValue));//boolean
-----------

Javascript and Jquery 高清全彩最新英文版本 pdf 作者 Jon Duckett 加油! 立即下载

相关推荐

《锋利的JQuery》读书笔记 本书精华汇总完整版

《锋利的JQuery》是一本国内非常不错的JQuery入门书,基本上通读本书后对JQuery的精髓都能掌握了,稍后再通过多加实践应该能对Jquery有比较好的理解了。下面是笔者对整本书的读书笔记,也算是对全书主要内容的一个总结吧。本笔记对该书中的重要进行了完整的汇总。值得你下载哦。

JavaScript+jQuery,交换式web前端开发

JS学习switch语句。

chen1119_的博客 911

JQuery版图书馆管理系统功能演示

1、系统需求分析及数据库建模 2、主界面WebOS搭建 3、实现图书馆管理系统的登录 4、实现图书馆信息管理 5、更改口令及利用用户自定义控件技术简化代码 6、利用母板页技术及JSOOP思想实现书架信息管理(1) 7、利用母板页技术及JSOOP思想实现书架信息管理(2) 8、系统管理-权限设置 9、实现读者管理-读者类型管理 10、实现图书管理-图书类型管理 11、实现读者管理-读者档案管理(1) 12、实现读者管理-读者档案管理(2) 13、实现图书管理-图书档案管理 14、实现图书借阅功能 15、实现图书续借及归还功能 16、实现系统查询模块-图书档案与图书借阅查询 17、实现图书借阅排行榜及报表打印 18、完善权限控制及实现桌面快键方式功能 19、图书借阅排行榜-数据统计分析及图表显示 20、利用jquery-treeview实现读者借书清单

jquery初学者_2020年面向初学者的终极jQuery指南。

jquery初学者Interactive front-end web development starts with Javascript, and jQuery offers you a simple way to achieve a lot of common javascript tasks. With this article, I’ll hope to teach you the fun...

weixin_26737625的博客 228

Jquery实战_读书笔记1&mdash;选择jQuery

近期公司积极组织我们这些开发人员学习进步,督促我们学习更多的技术来提高自己。为此我选择了jQuery作为我学习的方向,同时我也是想将我的学习心得分享给大家,以后我会不断的更新一系列jQuery方面的学习纪要,帮助大家学习。

利用GPAC生成MP4文件

GPAC主要针对学生和内容创作者,代表了一个跨平台的多媒体框架,开发人员可以使用它在 LGPL 许可下制作开源媒体。GPAC多媒体框架兼容范围广泛的流行文件类型,从常见格式(如 AVI、MPEG 和 MOV)到复杂格式(如 MPEG-4 系统或 VRML/X3D)和 360 电影。

深之JohnChen的专栏 1773

jQuery读书笔记

一、选择符1.选择所有带title属性的链接:$('a[@title]')。2.取得包含一个ol的元素的所有div元素:$('div[ol]')。3.属性选择符允许以类似正则表达式的语法标识字符串的开始(^)和结尾($),使用星号(*)表示字符串中的任意位置。4.取得所有电子链接:$('a[@href^="mailto:"]')。5.取得所有指向PDF文件的链接:$('a[@href$=".pdf"]')。6.取得所有内部链接:$('a[@href*="mysite,com"]')。7.从匹配的带有myDi

励志的蜗牛 976

【自动驾驶】控制算法(十)深度解析车辆纵向控制 | Carsim 油门刹车标定表的制作...

写在前面: ???? 欢迎光临 清流君 的博客小天地,这里是我分享技术与心得的温馨角落。???? ???? 人生如戏,我们并非能选择舞台和剧本,但我们可以选择如何演绎 ????感谢您的支持与关注,让我们一起在知识的海洋中砥砺前行~~~文章目录引言一、油门标定原理1.1 油门与速度、加速度的关系1.2 油门控制曲面模型的构建二、油门标定表的制作流程...

qq_35485206的博客 2140

jquery学习总结

了解JQuery之后要回答的几个问题: 1.jquery 中如何将数组转化为 json 字符串,然后再转化回来? jQuery中没有直接提供将数组转化为json字符串的方法,但我们可以编写jQuery实例对象的扩展: $.fn.stringifyArray = function (array) { return JSON.stringify(array);//把一个数组转换成J...

南风 3856

从零开始:Doherty功率放大器的ADS仿真实践指南

本文详细介绍了Doherty功率放大器在ADS中的仿真设计流程,从基础原理到实际工程应用。通过负载调制技术,Doherty结构显著提高了功率放大器的效率,特别适合处理高峰均比信号。文章包含ADS环境搭建、对称与非对称设计、常见问题调试等实用内容,为射频工程师提供全面的实践指南。

weixin_29313547的博客 694

西门子 G120 变频器报文

G120报文

mmxxoo_xxmmp的博客 8092

jQuery学习总结一

jQuery jQuery是一个优秀的JavaScript框架,轻量级的JS库,封装了JS、CSS、DOM。 方便处理HTML、Event、实现动画效果,方便为网站提供AJAX交互。 使用户的HTML页面保持代码和HTML页面分离。 轻量级:侵入性低 耦合度低 重量级:侵入性高 耦合度高 jQuery使用步骤: 1.引用jQuery 2.使用jQuery选择器定位节点 3.调用jQuery...

千铭丶博客 3049

Qwen3-Omni-30B-A3B-Instruct微调指南:如何打造专属智能博物官(附数据集)

本文详细介绍了如何对Qwen3-Omni-30B-A3B-Instruct模型进行微调,以打造专业的智能博物官。指南涵盖了从理解模型架构优势、构建高质量文博数据集,到使用LLaMA-Factory进行实战微调、效果评估与部署优化的完整流程,并提供了关键的环境配置与性能优化建议,帮助开发者在垂直领域高效定制专属AI助手。

weixin_29096377的博客 1144

锋利的jQuery读书笔记-第1章 认识jQuery

一. 、关于JavaScript 1. JavaScript是Netscape公司开发的一种脚本语言,它使得网页可以包含更多的元素,并且更加丰富精彩。 2. JS自身存在3个弊端:1.复杂的文档对象模型(DOM);2.浏览器实现不一致;3.缺乏调试工具。 3. 由于Ajax(Asynchronous JavaScript And XML,异步的JS和XML)的诞生,JS才真正

江湖小虾米 623

安装并新建windows下wxwroks7.0 bootrom工程

安装licence,将zwrsLicense-vx7-perm.lic粘贴到安装目录C盘WindRiver/license下。现在双击Workbench 4,新建vxworks7.0工程,会出现下面的情况,因为没有licence。编译完成binaries下生成wxwroks x86格式,可以修改bootrom硬件信息的配置了。单击x86_wxwroks工程右键,build project编译工程。双击桌面Workbench 4打开,新建windows下工程。新建完成,选择finish。

wangjie36的博客 1923

基于YOLOv10的机器人抓取引导系统:从物体检测到精准抓取

python# 数据标注工具简化版import os"""启动标注工具""""""标注单张图像"""print(f"标注图像: {os.path.basename(img_path)}")print("请在图像上绘制抓取矩形框...")# 这里应该实现交互式标注界面# 简化版本直接返回示例标注# 示例标注数据"""保存标注结果"""# 保存为YOLO格式# 转换为YOLO格式。

YOLO 378

疯狂的Jquery笔记

1 $(“#foo”)== jQuery(“#foo”) :$符号是jQuery的一个简写形式2 DOM对象和jQuery对象的区别:jQuery对象是通过jQuery包装DOM对象后产生的对象,jQuery对象可以使用jQuery里的方法。$(&quot;#foo&quot;).html(); 等同于=&amp;gt;document.getElementById(&quot;foo&quot;).innerHTML; //获取id为foo的...

小小柚 341

uniapp [安卓苹果App端] - 实现获取请求手机位置权限+开启定位获取经纬度/省市区地址等,检测权限手机定位是否开启并引导用户同意授权,uniApp app端调用本机开启本机定位权限及IP属地

uni-app,手机定位权限,安卓Android,苹果ios,uniapp获取本机位置权限,uni-app获取用户定位数据,uniapp APP获取用户IP属地定位,判断权限,权限被拒绝了怎么办,苹果ios系统无法开启定位,获取定位权限报错,uniapp定位获取省市区,UNI-APP如何开启手机定位功能并获取经纬度,不依赖地图第三方插件组件,打包上架后如何获取,真机运行无法获取定位,安卓和ios权限获取,判断权限检查,正式打包,详细教程,根据获取当前经纬度,再根据经纬度去定位具体省市区,自定义基座打包能成功

🏆 前端领域优质创作者 1万+

win7下 eclipse “Could not create the java virtual machine”解决方法

-startup plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.0.v20100503 -product org.eclipse.epp.package.php.produc

风达的专栏 7948

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

深度学习工具包 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&#39;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 = &quot;R. B. Palm&quot;, title = &quot;Prediction as a candidate for learning deep hierarchical models of data&quot;, year = &quot;2012&quot;,}```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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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 &lt; 0.10, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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 &lt; 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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&lt;0.12, &#39;Too big error&#39;);```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(&#39;state&#39;,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 &lt; 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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 &lt; 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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 &lt; 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free &quot;Bitdeli Badge&quot;)

win 7 64位系统安装java jdk 遇到could not find the required version of the java 2 runtime environment 错误

首先安装jre7到C:\Program Files\Java  然后把下载的jdk.exe放在c根目录下 打开命令提示符,在c目录下运行  jdk.exe -j "C:\Program Files\Java\jre7 "

石佛永不老 4863

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

《锋利的jQuery》的读书笔记 -- jQuery应用实例

jQuery应用实例

我飞故我在的专栏 1162

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex&trade;-M4F 内核的信息,请参见《Cortex&trade;-M4F 技术参考手册》。

上一篇: Javascript from Zero to Proficiency by Patrick Felicia 笔记
下一篇: Convert Formula To Text String With Find And Replace Feature
CodingIsFun
博客等级 码龄8年 37粉丝 240原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值