COMP9021 Solving crosswords

基于FT2232集成USB直接实现XilinxJTAG和UART串口 使用“program_ftdi -write -ftdi FT2232H -serial 0ABC01 -vendor "my vendor co" -board "my board" -desc "my product desc"”命令进行数据烧写,该命令会将FT2232的通道A配置为JTAG,其余通道配置为UART,serial长度为6~12个字符(vivado扫描JTAG时显示的cable序列号,同一台PC能够同时连接多个不同序列号的cable仿真器)。图 2 program_ftdi的帮助信息。 阅读详情


1 General matters
1.1 Aim
Assignment 2 COMP9021, Trimester 3, 2024
The purpose of the assignment is to:
• develop your problem solving skills;
• design and implement the solutions to problems in the form of medium sized Python programs; • practice the design and implementation of search techniques, with recursion as a good approach; • design and implement an interface based on the desired behaviour of an application program;
• possibly practice using the re and numpy modules.
1.2 Submission
Your program will be stored in a file named crossword.py. After you have developed and tested your program, upload it using Ed (unless you worked directly in Ed). Assignments can be submitted more than once; the last version is marked. Your assignment is due by November 18, 10:00am.
1.3 Assessment
The assignment is worth 13 marks. It is going to be tested against a number of inputs. For each test, the automarking script will let your program run for 30 seconds.
Assignments can be submitted up to 5 days after the deadline. The maximum mark obtainable reduces by 5% per full late day, for up to 5 days. Thus if students A and B hand in assignments worth 12 and 11, both two days late (that is, more than 24 hours late and no more than 48 hours late), then the maximum mark obtainable is 11.7, so A gets min(11.7, 12) = 11.7 and B gets min(11.7, 11) = 11.
The outputs of your programs should be exactly as indicated. 1.4 Reminder on plagiarism policy
You are permitted, indeed encouraged, to discuss ways to solve the assignment with other people. Such discussions must be in terms of algorithms, not code. But you must implement the solution on your own. Submissions are routinely scanned for similarities that occur when students copy and modify other people’s work, or work very closely together on a single implementation. Severe penalties apply.
1

2 Solving crosswords 2.1 General description
The aim is to fill in a crossword grid, in which some letters might have been placed already, in one of two ways:
• being given the collection of all missing entries in an underlying solution to the crossword, find a way to place those entries in the grid (in one of possibly more than one way);
• being given a collection of words, find a way to select and place some of those words in the grid so that it solves the puzzle (in one of possibly more than one way).
We will consider grids with at least 2 rows and at least 2 columns, and such that any cell is next to another cell, though maybe not next to both horizontal and vertical cells; so any cell is part of a word of at least 2 letters, and by word we mean a word with at least 2 letters.
A presentation of a grid provided as input will be captured in a .tex file, and a presentation of a solved puzzle will also be captured in a .tex file; those .tex files can be given as arguments to pdflatex to generate .pdf files that display grids in a pleasing graphical form, but play no role in the assignment.
The code will be all about the design and implementation of a Crossword class. An object of class Crossword will provide an interface to work with a particular grid and collections of words of the kind just described; it will have methods for both problems previously described, and also benefit from the implementation of the __str__() special method to display some information about the grid and the words it possibly contains already.
partial_grid_3.tex is an example of a .tex file for a grid in which letters have been placed already, that can be considered as an input file, and here is the .pdf file created by pdflatex from this .tex file. solved_partial_grid_3.tex is an example of a .tex file for a solution to that grid, that can be
considered as an output file, and here is the .pdf file created by pdflatex from this .tex file. The contents of all input .tex files will be of the following form:
\documentclass{standalone}
\usepackage{pas-crosswords}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
...
\end{tikzpicture}
\end{document}
For input files, what lies between \begin{tikzpicture} and \end{tikzpicture} is of the following form:
\begin{crossgrid}[h=_, v=_]
\blackcases{_/_, ..., _/_}
\words[v]{_/_/_, ..., _/_/_}
\words[h]{_/_/_, ..., _/_/_}
\end{crossgrid}
Each of
• \blackcases{_/_, ..., _/_},
• \words[v]{_/_/_, ..., _/_/_} and • \words[h]{_/_/_, ..., _/_/_}
2

is optional and can appear in any order.
• In \begin{crossgrid}[h=_, v=_], the first and second occurrences of _ denote integers at least equal to 2, that represent the horizontal dimension and the vertical dimension of the grid, respec- tively; let h-dim and v-dim denote those dimensions, respectively.
• In \blackcases{_/_, ..., _/_}, each occurrence of _/_ denotes a slash-separated pair of integers (i,j) with 1 ≤ i ≤ h-dim and 1 ≤ j ≤ v-dim, to denote that there is a black square at the intersection of the ith column and the jth row. If \blackcases{_/_, ..., _/_} is present then there is at least one such pair, consecutive pairs being separated by a comma.
• In \words[v]{_/_/_, ..., _/_/_}, each occurrence of _/_/_ denotes a slash-separated triple (i,j,w) where i and j are integers with 1 ≤ i ≤ h-dim and 1 ≤ j ≤ v-dim, and where w is a word of at least 2 letters that is vertically placed in the grid and whose first letter is at the intersec- tion of the ith column and the jth row. If \words[v]{_/_/_, ..., _/_/_} is present then there is at least one such triple, consecutive triples being separated by a comma.
• In \words[h]{_/_/_, ..., _/_/_}, each occurrence of _/_/_ denotes a slash-separated triple (i,j,w) where i and j are integers with 1 ≤ i ≤ h-dim and 1 ≤ j ≤ v-dim, and where w is a word of at least 2 letters that is horizontally placed in the grid and whose first letter is at the intersection of the ith column and the jth row. If \words[h]{_/_/_, ..., _/_/_} is present then there is at least one such triple, consecutive triples being separated by a comma.
You can assume that the input is valid: no word or black square will start or extend beyond the dimensions of the grid.
For output files, what lies between \begin{tikzpicture} and \end{tikzpicture} is of the form \gridcross{_, ... _} where _, ... _ is a comma-separated sequence of v-dim strings, each of length h-dim, to denote from top to bottom each of the rows of the filled grid, using *s to represent black squares, and using uppercase letters for the grid’s entries.
In .tex files, there can be spaces between tokens almost everywhere (the pas-crosswords package actually prevents spaces to be used around some of the / characters). Also, in .tex files, the leftmost occurrence of a % marks the beginning of a comment that runs from this symbol included all the way to the end of the physical line, including the \n character. This allows one to have many physical lines to represent a unique logical line, and can be used to, for instance, have \blackcases{_/_, ..., _/_}, \words[v]{_/_/_, ..., _/_/_}, \words[h]{_/_/_, ..., _/_/_} and \gridcross{_, ... _} split over more than one physical line and improve readability. It is therefore advisable to process a .tex file in such a way that its content is captured as a single string with all space removed, before searching for patterns of interest in this string.
2.2 Analysing a grid (3 marks)
Your program will allow Crossword objects to be created from .tex files that you can assume are stored in the working directory, and whose contents satisfy all conditions spelled out in Section 2.1. Making use of the .tex files empty_grid_1.tex, empty_grid_2.tex, empty_grid_3.tex, partial_grid_1.tex, partial_grid_2.tex and partial_grid_3.tex, having for associated .pdf files empty_grid_1.pdf, empty_grid_2.pdf, empty_grid_3.pdf, partial_grid_1.pdf, partial_grid_2.pdf and partial_grid_3.pdf, here is a possible interaction.
Passing as argument to print() a denotation of a Crossword object results in an output of the kind A grid of width _ and height _, with _ black case[s], filled with _ letter[s],
with _ complete vertical word[s] and _ complete horizontal word[s]. where
• the first occurrence of _ is a number that represents the horizontal dimension of the grid, 3

• the second occurrence of _ is a number that represents the vertical dimension of the grid,
• the third occurrence of _ is no, 1 or a number at least equal to 2 that represents the number n of
black cases in the grid (of course it is case if n = 1 and cases otherwise),
• the fourth occurrence of _ is no, 1 or a number at least equal to 2 that represents the number n of
letters alredy placed in the grid (of course it is letter if n = 1 and letters otherwise),
• the fifth occurrence of _ is no, 1 or a number at least equal to 2 that represents the number n of
vertical words in the grid (of course it is word if n = 1 and words otherwise), and
• the sixth occurrence of _ is no, 1 or a number at least equal to 2 that represents the number n of
horizontal words in the grid (of course it is word if n = 1 and words otherwise).
2.3 Filling in a grid with given words (5 marks)
Crossword objects can call the fill_with_given_words() method, that takes two arguments.
• First, the name of a .txt file, meant to exist in the working directory and store a number of words, one word per line (without empty line, without space on any line). You can assume that the file indeed exists and has the expected contents. The file could be empty, and there could be more than one occurrence of a given word.
• Second, the name of a .tex file, meant to store a representation of a solution in case a solution exists.
The aim is to complete all missing entries precisely with the words stored in the file provided as first argument; so there should be as many words in the file as there are incomplete words in the grid; words do not have to be distinct in the file, because a given word can appear more than once in a grid.
If the task is impossible, then the method prints out:
Hey, it can't be filled with these words!
Otherwise, the method prints out:
I filled it!
Result captured in _.
where _ is the name of the .tex file that has been provided as argument to the method. The solution that has been discovered is stored in that file. If the file does not exist then it is created, in the working directory; if it does exist then it is overwritten. There could be more than one solution; only one solution is sought after, and any correct solution is acceptable. In any case, the method returns None.
Here is a possible interaction.
• The .tex files that have been created or overwritten during this interaction are
– filled_empty_grid_2.tex,
– filled_empty_grid_3.tex and – filled_partial_grid_2.tex.
• The associated .pdf files are
– filled_empty_grid_2.pdf,
– filled_empty_grid_3.pdf and – filled_partial_grid_2.pdf.
It is advisable to make sure that the spaces in the .tex files produced during the interaction are exactly as shown. Still, whitespace will be ignored for assessment purposes, but of course, all other nonspace characters have to be exactly the same, character for character.
4

2.4 Solving a crossword (5 marks)
Crossword objects can call the solve() method, that takes as argument the name of a .tex file, meant to store a representation of a solution in case a solution exists.
The aim is to complete all missing entries with words from the file dictionary.txt. That file is provided, meant to be stored in the working directory, and you can assume that this is the case indeed. A word in dictionary.txt could be used more than once, because a given word can appear more than once in a grid. The grid could already contain complete words that are not in dictionary.txt. This is fine. It should not be checked that any complete word in the input grid is in dictionary.txt; this might not be the case, and that is fine. But any incomplete or missing word has to be one from dictionary.txt.
If the task is impossible, then the method prints out:
Hey, it can't be solved!
Otherwise, the method prints out:
I solved it!
Result captured in _.
where _ is the name of the .tex file that has been provided as argument to the method. The solution that has been discovered is stored in that file. If the file does not exist then it is created, in the working directory; if it does exist then it is overwritten. There could be more than one solution; only one solution is sought after, and any correct solution is acceptable. In any case, the method returns None.
Here is a possible interaction.
• The .tex files that have been created or overwritten during this interaction are
– solved_empty_grid_1.tex,
– solved_empty_grid_2.tex,
– solved_partial_grid_1.tex and – solved_partial_grid_3.tex.
• The associated .pdf files are
– solved_empty_grid_1.pdf,
– solved_empty_grid_2.pdf,
– solved_partial_grid_1.pdf and – solved_partial_grid_3.pdf.
It is advisable to make sure that the spaces in the .tex files produced during the interaction are exactly as shown. Still, whitespace will be ignored for assessment purposes, but of course, all other nonspace characters have to be exactly the same, character for character.
 

使用 Python 实现无人机避障的人工势场算法 人工势场算法是一种基于力的控制方法,通过将目标位置视为一个吸引力源,而将障碍物视为排斥力源,来引导移动体朝着目标前进,同时避开障碍物。接下来,我们将定义几个类来实现人工势场算法,包括无人机类、障碍物类和势场类。 阅读详情

相关推荐

DSP28335量产升级避坑指南:C2Prog串口烧录.hex文件,为什么我推荐COM1?

本文详细解析了DSP28335量产升级中C2Prog串口烧录.hex文件的最佳实践,重点推荐使用COM1端口以确保稳定性。通过实测数据和底层机制分析,揭示了Windows系统对COM1的特殊优化及C2Prog工具的时钟切换逻辑,帮助开发者规避常见陷阱,提升烧录成功率。

weixin_27066963的博客 385

学习C#开源报表组件Seal Report(45:报表服务安全配置)

学习Seal Server Manager软件内与报表服务安全配置相关的各类属性的用途

gc_2299的博客 161

从ViT到CLIP:OpenAI如何用4亿张图‘教会’AI看懂世界?一次讲透对比学习与Prompt工程

本文深入解析OpenAI的CLIP模型如何通过4亿图文对的对比学习实现跨模态理解,详细探讨了对比学习、数据构建、模型架构及Prompt工程等核心技术。CLIP利用Transformer架构和精心设计的Prompt模板,在Zero-Shot分类、图像检索等场景展现出强大能力,为多模态AI应用开辟新方向。

weixin_27027459的博客 373

Advance Steel工具栏菜单的创建

创建jigdesignpalettedata.xml文件并放置于...\INT\Steel\Support\Toolbars\目录下,随后修改C:\ProgramData\Autodesk\Advance Steel 2025\INT\ASSettings_User.xml,添加对应键值对以加载该配置。示例中设置面板位置、大小及可见性,通过ParentId指定父窗口,确保自定义工具栏正确显示。

Advance Steel二次开发 39

Matlab实战:水声信号DEMON谱分析从入门到精通(附完整源码)

本文详细介绍了使用Matlab进行水声信号DEMON谱分析的完整流程,从基础理论到实战应用,涵盖信号预处理、包络提取、频谱分析等关键步骤,并附完整源码。特别针对水声通信中的低信噪比环境,提供了多种优化方案和性能提升技巧,帮助读者快速掌握这一水下目标检测的核心技术。

gamma的博客 297

别再手动算临界转速了!用ANSYS Workbench 2023 R2快速搞定转子坎贝尔图(附完整APDL命令流)

本文详细介绍了如何利用ANSYS Workbench 2023 R2快速生成转子坎贝尔图,实现全自动临界转速分析。通过对比传统手动计算与Workbench自动化流程的效率差异,展示了其在旋转机械设计中的革命性优势,包括大幅缩短分析周期、提升精度至98.7%。文章还提供了完整的APDL命令流和实战案例,帮助工程师快速掌握这一高效工具。

weixin_42699679的博客 477

C# 系列教程_12 字符串 string 保姆级系统教程(面向新手,大量示例 + 原理讲解)

C#中string与String为同一类型,均为不可变引用类型,任何“修改”操作均返回新字符串。常用创建方式包括字面量、逐字字符串@""、插值$""及new String()。字符串本质是字符数组,支持索引访问但不可修改。所有方法如IndexOf、Substring、Replace等均不改变原字符串,返回新实例。

zhanghaha1314的博客 282

OctoMag: An Electromagnetic System for 5-DOF Wireless Micromanipulation

电磁线圈组驱动经典系统,可以作为参考。 OctoMag: 用于5自由度无线微操作的一个电磁铁系统 OctoMag: An Electromagnetic System for 5-DOF Wireless Micromanipulation [1] Paper Link Authors: J. J. Abbott, etc. 2010, TRO IEEE Transactions on Robot...

XU Yangxin的博客 1666

Swift 字符详解:从 Character 到字符串遍历

Swift中Character代表扩展字形簇,符合人类对“一个字符”的直观理解。它与String为集合关系,可通过for-in遍历或数组拼接。Character基于Unicode,组合字符(如带重音字母、表情符号)视为整体,count统计字形簇数而非码点或字节。访问需用String.Index,不可直接整数下标。字符支持比较、大小写转换及ASCII互转,但必须用双引号声明,且与String类型区分。理解其设计可避免常见错误,提升字符串处理可靠性。

2402_85743155的博客 305

手把手教你学Simulink——基于经典滤波器设计的场景:低通滤波器(LPF)的设计与频率响应仿真

滤波器是信号处理领域中非常重要的组件,用于去除不需要的频率成分或者提取有用的频率信息。低通滤波器(Low-Pass Filter, LPF)允许低于某个特定截止频率的信号通过,同时衰减高于该截止频率的信号。在本教程中,我们将学习如何使用设计一个简单的模拟低通滤波器,并对其频率响应进行仿真分析。本文介绍了如何使用设计一个简单的模拟低通滤波器,并通过仿真展示了其应用效果。通过这样的实践,您不仅能够加深对滤波器工作原理的理解,还能掌握利用Simulink进行滤波器设计与仿真的基本技能。

MHD0815的博客 5724

关于机器人精度的总结(重复精度和绝对精度区分)

机械臂是工业生产中的重要设备,在焊接码垛 以及 非 接触测量等 领域中有 着重要应 用。然而由于机械臂本体制造中存在机械制造公差装配误差导致的运动学参数误差以及电机转角与关节转角间减速比误差等,导致机械臂存在。因此需要对机械臂进行标定,提高机械臂的绝对定位精度。ABB系列某款机器人精度参数表。

大胡子大叔的专栏 1万+

C#转Python第5.3篇:类型提示与静态分析:Python 的“伪静态类型“

Python的类型提示是“伪静态类型”——注解由IDE和工具(如mypy)使用,解释器运行时忽略。与C#强制编译时类型检查不同,Python类型注解仅作开发辅助,提升代码可读性、智能提示与静态分析能力。通过List[int]、Optional[str]、Protocol等特性,实现类型安全与泛型支持。Python 3.14起引入延迟求值与annotationlib,优化性能并支持前向引用。核心理念:类型注解是“给开发者看的文档”,而非运行时保障。

hanzhixintianxia的博客 267

python 实现一个完整的基于Python的多视角三维重建系统,包含特征提取与匹配、相机位姿估计、三维重建、优化和可视化等功能

本文介绍了一个基于Python的多视角三维重建系统的实现,涵盖了特征提取与匹配、相机位姿估计、三维重建、优化和可视化等功能。首先,系统通过安装必要的库(如OpenCV、NumPy等)并加载图像数据,初始化相机参数。接着,系统使用SIFT、SURF或ORB算法提取图像特征点,并通过FLANN或BF方法进行特征匹配,应用Lowe's ratio test筛选优质匹配。该系统为后续的相机位姿估计和三维重建奠定了基础,能够从多视角图像中恢复三维场景结构。

huanghm88的专栏 619

第6章第4节:自定义分词器

本节详解Elasticsearch自定义分词器,解析analyzer三段式结构(char_filter→tokenizer→filter),掌握常用组件如ik_max_word、synonym_graph、ngram等。通过_analyze API调试分词效果,实现“索引时扩展同义词、搜索时不带”的生产级方案,提升中文搜索与智能提示体验。

啊渊的专栏 798

深度学习工具包 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")

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

C# 数据结构和特殊类型

.NET Core(现称.NET)提供丰富数据结构,优化性能与开发效率。日常开发首选List<T>和Dictionary<TKey,TValue>;高性能场景推荐Span<T>与Memory<T>减少内存分配;并发环境使用ConcurrentDictionary等线程安全集合;避免非泛型集合如ArrayList。

cccloveforever的博客 765

ssm框架搭建

这个是一个在idea上成功跑起来的ssm框架项目,保存在这里方便以后使用直接下载

SQL 基础查询与模糊查询全解 + C# WinForm 数据库连接实战:ADO.NET、参数化查询与 where 1=1 动态条件

上篇把表建好、关系连好。,再。从select *到,从到,从拼字符串到参数化,最后讲清楚where 1=1到底解决什么问题——顺便把课上那道选择题的答案讲透。

2501_94699871的博客 172

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

C# NModbus4 实战:ModbusTCP 读取以太网温湿度传感器

本文基于C#与NModbus4库,实战演示如何通过ModbusTCP协议读取以太网温湿度传感器(如H-THRJ45)数据。涵盖设备配置、寄存器地址解析、缩放换算及常见调试坑点,提供可运行的控制台Demo,适用于机房动环、GSP库房等物联网场景。代码支持异步扩展、数据持久化与告警逻辑,助力快速搭建自研采集系统。

weixin_41865733的博客 284

C# 系列教程_10 方法(Methods)保姆级精讲

本文系统讲解C#方法的定义与使用,涵盖语法结构、参数传递、返回值、作用域及重载机制。通过无参无返回值、有参、有返回值等示例,阐明方法如何减少冗余、提升代码可读性与维护性。重点强调方法重载(同名异参)、返回值类型不可单独决定重载、局部变量作用域限制等核心概念,并提醒新手常见误区,如缺少return、误判重载条件等。最后介绍可选参数与传值机制,帮助初学者掌握方法调用的规范与技巧。

zhanghaha1314的博客 340

BPE分词器的完整实现:字节对合并与词表构建

本文深入解析了大语言模型分词器的核心机制,以字节级BPE为例,揭示其如何将文本转化为token。通过字节编码实现无外生词(OOV)问题,但带来跨语言价差与计数故障等挑战。文章完整实现BPE训练与编码逻辑,强调预切分正则与语料配比的关键作用,并指出分词器不仅是技术组件,更是决定模型感知粒度与成本结构的底层决策——它塑造了模型对文字的理解方式,也影响着每一次推理的效率与费用。

2601_96733043的博客 293

C# ScottPlot 曲线控件

本文介绍使用ScottPlot.WinForms在WinForms中绘制高性能图表的实践。通过NuGet安装后,实现多种图形绘制:添加水平/垂直参考线、信号图与散点图(支持百万级数据)、自定义线段及多曲线叠加,并通过异步任务实现实时动态曲线更新,结合Refresh()与AutoScale优化渲染性能,有效解决大数据量下的显示问题。

m0_47020592的博客 44

C# SerpBase 谷歌搜索API:请求、建模与核账实战

上周二晚上 9 点 40 分,我还在改一个 .NET 看板:运营要监控 300 个品牌词在谷歌美国区的排名,第二天早上 10 点演示。原来基于 HtmlAgilityPack 硬解析页面的服务连续三天被拦截,返回忽长忽短。我决定连夜换成结构化搜索 API,用 C# 接,最后选了 SerpBase——它是纯 HTTP 的 POST JSON 接口,Base URL 固定为,.NET 这边不用任何第三方 SDK,一个HttpClient就能打通,而且同一个 Key 可以覆盖文档里列出的 43 个端点。

Y381532662的博客 194

用Python删除PPTX中的牛皮癣广告

本文介绍了一款免费的PPTX广告清理工具,利用Python与python-pptx库实现批量删除模板中的广告元素。该工具可自动清除幻灯片备注、母版名称、文档属性、最后两页广告页,并支持关键词搜索替换隐藏广告。通过GUI界面实现文件导入与一键清理,大幅提升效率,避免手动操作耗时出错。代码开源免费,适合需要快速处理大量带广告PPT模板的用户。

henanlion的博客 234

如何使用C#代码清理 Excel 表格中的空白行与空白列

通过 C# 代码,可以自动检查并删除 Excel 工作表中的空白行和空白列。利用IsBlank属性判断行或列是否为空,再分别调用和方法,即可完成清理操作。与手动逐行、逐列检查相比,这种方式更适合处理包含大量数据的 Excel 文件,能够减少重复操作,提高数据整理效率,使工作表保持整洁、清晰。在实际使用中,建议从工作表的末尾向前遍历并删除空白行和空白列,避免删除操作改变索引位置,影响后续检查。

2501_93070778的博客 239

使用C#代码在 Word 中设置行距和段落间距

通过 C# 代码,可以灵活调整 Word 文档中的行间距和段落间距,从而改善文档的整体排版效果。设置段前间距: 使用属性调整段落前方的空白距离。设置段后间距: 使用属性调整段落后方的空白距离。设置行间距: 使用属性控制同一段落中各行文本之间的距离。合理设置这些间距,不仅可以提高 Word 文档的可读性,还能优化页面空间利用率。这种方式适用于批量格式调整、自动化文档生成以及统一文档排版等场景。

2501_93070778的博客 202

QML学习日记 Day2:布局控件+登录界面

Column是纵向布局,里面的子控件,不要写 top、bottom、verticalCenter;Row是横向布局,里面的子控件,不要写 left、right、horizontalCenter;定位器规则:自动排布子控件,布局方向上,子控件不要写同方向锚点,会冲突;锚点原理:把控件边缘绑定到父控件、或者别的控件的边缘,窗口缩放时自动适配位置。作用:基础可视容器,用来做背景、色块、边框、圆角面板,包裹其他子控件。控件放满一行,自动换行。1. QtQuick:底层图形、基础容器、基础文字、基础输入、定位器;

2201_75293893的博客 439

Avalonia 设备监测实战设计|高频采样怎么接到实时曲线、热力图和 3D 视图?

设备每秒推来的采样批次和页面刷新的节奏通常不同。把每条采样直接推给 UI,会让绘制次数跟着输入速率增长。用做 Avalonia 监测页面时,可以把采集、显示窗口和视图更新拆开,再用测点 ID 把三个视图串起来。

2501_91602431的博客 70
上一篇: CS202: WeensyOS
下一篇: CCIT4020 Computer Programming
wx____codinghelp
博客等级 码龄2年 771粉丝 115原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值