CS4386AIGameProgramming

「文智助手」全场景办公AI助理AI+OPC全流程实践方案(大赛作品) 阅读详情

CS4386AIGameProgramming
Assignment2:
TheX-patternGame
Set by CS4386 TA Team
Early Testing Deadline:
Thursday 28th 23:59 March2024
Sunday7th23:59 April 2024
Final Submission Deadline:
Sunday21th 23:59 April 2024
This assignment is worth
20 %(twenty percent)
of the overall course mark
Overview
1 Introduction
2 Marking scheme
3 TheX-pattern Game
4 Online Judgment platform
5 Requirements
6 Q&A
1 Introduction
You are tasked with writing an AI program that can run the X-pattern game, you
can implement your AI program using algorithms including but not limited to
those learned in class. You can use Python, C or C++ to implement your AI
program. An online AI game judgment platform is provided to submit and test
your code.
2 Marking scheme
Item
Due
Mark
Beat preset AI
Tournament1
Tournament2
Tournament3
Report
21th April 2359
28th March 2359
7th April 2359
21th April 2359
21th April 2359
30
0
20
20
30
Total
100
Note: Your AI performance depends on:
● Whetheryoubeat our three preset AIs. If you beat all our three preset AIs,
you will get 30 points (10 points for each AI).
● Yourranking in tournaments. We will schedule three tournaments. After
each tournament, you’ll be able to see where your AI stands in the
rankings. These rankings are an integral part of your overall assessment.
In addition to the score from your AI performance, the quality of your algorithm
and report will also affect the final score. Take some time to make it look good.
3 TheX-pattern Game
The X-Pattern Game is a strategic board game where two artificial intelligence
(AI) players compete to form ‘X’ patterns on a 10x10 grid. Each player takes turns
to place their pieces, aiming to create as many ‘X’ patterns as possible to get
higher points. The game ends when the grid is filled(no more than 100 moves)
and the player who creates more X-pattern on the grid will be the winner. You
are encouraged to come up with your own strategies to make your AI make
better decisions in each turn. We are excited to see your brilliant ideas and how
they challenge each other !
2
Figure 1. Scoreshapeexamples
Whenthe gameends, we will calculate your score by counting the number of
full ‘X’ patterns in the grid. The player with the higher score will be the winner,
and the final score and game log will be provided. For example, in figure1, player
Ogains 4 points and player X gains 5 points, so player X is the winner.
4Online Judgment platform
Website URL: http://cs4386.cs.cityu.edu.hk/user/login/
This URL can only be accessed within the cityu campus network. If you want to
use this website outside the campus, please use cityu vpn first. The platform
supports Python, C and C++ as your program language.
Register and log in
● Youshouldregister using your Cityu email.
● Youshouldregister using your real name.
● Uponregistration, you will be arranged a useID. Only your ID will be
showed in the ranking.
Submit your code: play against preset AI
Click on “Game” in the left column, then you can see the X-pattern game. Click
“X-pattern” game then click “Submit Here” to go to the submission page. Fill in
your code and click “Submit” to submit. You can choose a language you are
familiar with.
3
4
Figure2. Submityourcodeandgetresult
We’ve set up three predetermined AI opponents for you to challenge: “Random,”
“Defensive,” and “Offensive,” designated by user IDs 1, 2, and 3, respectively. Upon
submitting your code, it will automatically be matched against the Random (AI1)
and Defensive (AI2). You’ll need to periodically refresh the page to view the
outcomes of these matches.
To ensure fairness, considering the advantage or disadvantage of starting first,
we’ll conduct two matches for each AI pairing. This includes one game where
your AI going first, and another where it plays second(opponent going first). The
results of these matches, along with the time and memory usage statistics, will
be updated following each submission.
To earn the “Beat preset AI” score, your most recent AI submission must
outperform our preset AIs in both match configurations—once your AI going
f
irst and once opponent going first. Please note, the matches against the
“Offensive AI” will not be visible during your testing phase.
5
Check log:
You can download the log to view the state of the chessboard at each step after
getting the results.
Figure 3. Foreachsubmission,youcanclickthedownloadlogs ile(format:
userid1_userid2 , userid1 is alwaystheplayergoing irst).Youcanalsoviewthelogs
directly on thewebsite.
View ranking
The system will save the most recent version of your code submitted prior to
each tournament deadline. The tournament itself takes place the day following
the deadline. On this “competition day,” the server will be offline. Your AI’s
performance will be evaluated based on its win rate across the matches(If there
is a draw it will not count as a win).
In instances where two participants’ AIs have identical win rates, the AI that
used less time to achieve its wins will receive a higher ranking. While you’re free
to check the rankings at any moment, it’s important to remember that these
interim rankings only compare your AI against our preset AI and not against the
entire field of competitors. Therefore, these preliminary standings do not
represent the final rankings for the tournament. The definitive rankings will be
announced once all matches are concluded and thoroughly evaluated.
6
5 Requirement
Format of the code:
● Theanswermustinclude the play_games function as the interface for
online judgment, which is defined as,
C/C++: void play_games(int step, int rival_decision1,int rival_decision2);
Python: play_games(step:int,rival_decision_x:int,rival_decision_y:int)->None
● stepindicates the move number in the current game. It starts from
Player A, step=1, then turns to player B, step=2, and then turns to
player A, step=3, …, end of the game.
● Thatis, player A’s step is always odd, player B’s step is even. Step=0
represents an empty checkerboard for initialization.
● rival_decision_x,y are the opponent’s decisions made in the
previous step, which can help you make better responses.
● Youcanreadtheboard and save the decision by read_ckbd, save_decsion
functions. MAX_M, MAX_N are the size of the board, (equal 10 in this
game). They are defined in battle_base.
● C/C++:void read_ckbd(int step, int array[MAX_M][MAX_N]);
void save_decision(int x, int y);
● Python: read_ckbd(step:int)->List[List[int]]
save_decision(x:int, y:int)->None
● Inthearray/list returned by read_ckbd, 0 represents the unplayed
area and you can make a decision here. 1 represents player A’s
decisions, 2 represents player B’s decisions.
● Notethat you must save your decision by calling save_decision in
play_games function, don’t return anything. Do not try to write
those functions, you just call them. You can read any step of chess
before the current step.
● Themainfunction is not allowed in the answer (especially for C/C++ ).
● Youcanuseprint/printf/cout to print logs to help you debugging. They
will be printed in the battle_log.txt.
● Thedetails of the read_ckbd, save_decsion functions are in the appendix.
Just for helping you run the battle on your computer. Please do not
include them in your answer.
7
Submission requirements:
● ForPythonusers: python base modules (in sys.modules.keys()): functools,
random, sorted, heapq, collections etc. are allowed. You are not allowed
to use other packages like numpy, sklearn etc.
● ForC/C++users: most header files are allowed, even including
<bits/stdc++.h>, and .
● Youcannotusesomesystemcalls like change directory, list file, create
f
ile, remove file etc.
● Forall AI programs, we limit the total running time and the total memory
usage, you can find it on the website.
● Violation of any of the above will raise an error and let the game be lost.
Requirement for the report:
You should write a report to explain your AI.
Describe your algorithm as clearly as possible. Feel free to use examples and add
screenshots or other figures if it can help better illustrate your method. If you
adopt some part of your code from somewhere, you must fully acknowledge this
and provide a reference to where you obtain the code. You must declare how
much of your submitted code is obtained from someone/somewhere else and
howmuchis indeed written by you.
At the end of your report, include the related references from where you have
gathered useful information in working on your assignment.
You need to submit your source code to the online judgment system and submit
your report to Canvas.
Nameyour files according to the following format, where XXXXXXXX is the 8
digits of your student ID number:
CS4386-2324B-A2-XXXXXXXX-Report.pdf (should be in PDF format)
6 Q&A
For any questions, please write an email to: yicongli4-c@my.cityu.edu.hk, We will
also create a discussion on Canvas. You can ask questions there and the TAs will
check it everyday and answer your questions as soon as possible.
8
Appendix: Sample submission code
Python:
import random
from battle_base import read_ckbd, save_decsion
def
play_games(step:int,rival_decision_x:int,rival_decision_y:int)->No
ne:
states = []
for s in range(max(step-2,0),step):
states.append(read_ckbd(s))
legal_decision = []
M,N = len(states[-1]),len(states[-1][0])
for m in range(M):
for n in range(N):
if states[-1][m][n]==0: # 0 is unplayed area
legal_decision.append((m, n))

make your decision here

decision = random.choice(legal_decision)
save_decsion(decision[0], decision[1])
9
C:
#include <stdio.h>
#include <stdlib.h>
#include “battle_base.h”
#define max(a,b) ((a) >= (b) ? (a) : (b))
void play_games(int step, int rival_decision_x,int
rival_decision_y) {
int states[2][MAX_M][MAX_N]; // Assuming MAX_M and MAX_N are
defined board size
int states_count = 0;
for (int s = max(step- 2, 0); s < step; s++) {
read_ckbd(s, states[states_count]);
states_count++;
}
int legal_decision[MAX_MMAX_N][2];
int legal_count = 0;
for (int m = 0; m < MAX_M; m++) {
for (int n = 0; n < MAX_N; n++) {
if (states[states_count- 1][m][n] == 0) // 0 is
unplayed area
{
}
}
}
{
legal_decision[legal_count][0] = m;
legal_decision[legal_count][1] = n;
legal_count++;
}
// Make your decision here
int random_index = rand() % legal_count;
int
decision = legal_decision[random_index]; // Example of
random strategy
save_decision(decision[0], decision[1]);
}
10
C++:
#include <stdio.h>
#include <stdlib.h>
#include
#include “battle_base.h”
void play_games(int step, int rival_decision1,int rival_decision2)
{
int states[2][MAX_M][MAX_N]; // Assuming MAX_M and MAX_N are
defined board size
int states_count = 0;
for (int s = std::max(step- 2, 0); s < step; s++) {
read_ckbd(s, states[states_count]);
states_count++;
}
int legal_decision[MAX_MMAX_N][2];
int legal_count = 0;
for (int m = 0; m < MAX_M; m++) {
for (int n = 0; n < MAX_N; n++) {
if (states[states_count- 1][m][n] == 0) // 0 is
unplayed area
{
}
}
}
{
}
legal_decision[legal_count][0] = m;
legal_decision[legal_count][1] = n;
legal_count++;
// Make your decision here
int random_index = rand() % legal_count;
int
decision = legal_decision[random_index]; // Example of
random strategy
save_decision(decision[0], decision[1]);
}
11
The following code is for reference only, do not include them in
your answer.
Battle_base.py
import os
DESCISION_TMP = os.path.join(‘decision.txt’)
BATTLE_LOG = ‘logs’
MAX_M = 10
MAX_N = 10
def read_ckbd(step):
try:
array =[]
txt_path = ‘{}/ckbd{:0>3d}.txt’.format(BATTLE_LOG,step)
with open(txt_path,‘r’) as f:
data_lists = f.readlines()
for lines in data_lists:
array.append([int(x) for x in lines.strip().split(’
‘)])
return array
except:
raise IndexError(‘Invalid read’)
def save_decsion(a,b):
with open(DESCISION_TMP,‘w’) as f:
f.write(’{:d} {:d}'.format(a,b))
12
Battle_base.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_M 10
#define MAX_N 10
#define BATTLE_LOG “logs”
#define DESCISION_TMP “decision.txt”
#ifndef BATTLE_h
#define BATTLE_h
inline int read_ckbd(int step, int array[MAX_M][MAX_N]);
inline void save_decision(int a, int b);
void play_games(int step, int rival_decision1,int
rival_decision2);
int read_ckbd(int step, int array[MAX_M][MAX_N]) {
char txt_path[100];
sprintf(txt_path, “%s/ckbd%03d.txt”, BATTLE_LOG, step);
FILE *f = fopen(txt_path, “r”);
if (f == NULL) {
printf(“Error opening file\n”);
return 1;
}
int array_index = 0;
char line[100];
while (fgets(line, sizeof(line), f)) {
char *token = strtok(line, " ");
int index = 0;
while (token != NULL) {
array[array_index][index] = atoi(token);
token = strtok(NULL, " ");
index++;
}
array_index++;
}
fclose(f);
13
return 0;
}
void save_decision(int a, int b) {
FILE *f = fopen(DESCISION_TMP, “w”);
if (f == NULL) {
printf(“Error opening file\n”);
return;
}
fprintf(f, “%d %d”, a, b);
fclose(f);
}
#endif
14

船载 OpenHarmony AIS 航海工作台:告警与防碰撞预警系统 船载OpenHarmony AIS航海工作台的告警与防碰撞系统,集成十余类告警(超速、偏航、会遇、SOS等),通过网格空间索引实现高效邻近判定,保障实时性。告警管理器统一调度规则、去重、通知与日志,支持悬浮球、语音、跑马灯、弹窗多渠道触达,确保航行安全。SOS紧急通道独立运行,避免干扰。系统设计强调性能优化与多场景适配,为航海安全提供核心支撑。 阅读详情

相关推荐

避开PSRR仿真三大坑:用Cadence psspxf分析分频器时,这些设置错了白忙活

本文深入探讨了使用Cadence psspxf工具进行分频器PSRR仿真时常见的三大技术陷阱,包括扰动信号参数设置、收敛性优化和后处理信号提取。通过详细的参数推荐和实战技巧,帮助工程师避免仿真误差,提升PSRR分析效率与准确性,特别适用于16分频器等数字-模拟混合电路设计。

weixin_29258297的博客 301

CS4386 Java

● Step indicates the move number dai 写CS4386、Java in the current game. It starts from。

wantwished的博客 753

ROS 2 Jazzy与Gazebo Harmonic仿真实战:从零搭建机器人仿真环境与高级应用

本文详细介绍了如何使用ROS 2 Jazzy和Gazebo Harmonic从零搭建机器人仿真环境,涵盖环境配置、传感器集成、多机器人协同和GPU加速优化等高级应用。通过实战案例和性能调优技巧,帮助开发者高效构建可靠的机器人仿真系统,提升开发效率。

h9j8k7l6m5n的博客 1217

6 款电商 AI 图片生成软件实测|国内 + 跨境卖家工具清单

电商 AI 作图工具已经从 "能不能用" 进入了 "好不好用" 的阶段。对于绝大多数卖家而言,现在的 AI 工具已经可以覆盖 60%-80% 的基础商品图需求,显著降低拍摄和设计成本。选择工具的核心逻辑不是 "哪款最强",而是 "哪款最适配你的品类、平台规模和团队能力"。垂直电商工具胜在工作流效率,通用生图工具强在创意上限,模板类工具赢在上手速度。建议根据自身业务阶段,搭配 1-2 款主力工具 + 1 款辅助工具,形成适合自己的视觉生产流程。

Mardi_Ladin的博客 379

Visual Studio 命令提示符工具区别与使用场景

Visual Studio会提供一系列命令提示符工具,这些工具应用在哪些场景呢?本文进行了相关介绍。

cicada15的博客 3493

脑机接口最新发展动态报告 (2024-2025)

脑机接口动态

高山 4106

视频隐私脱敏工程化:CSRT/KCF追踪算法在本地推理中的实现与边界

在短视频内容合规审查中,动态遮挡(Dynamic Masking)是高频且高耗时的环节。传统手动关键帧打码不仅效率低下,且在目标快速移动或遮挡时极易出现遮罩漂移。本文从计算机视觉工程角度,解析基于CSRT与KCF算法的目标追踪方案在视频隐私处理中的技术路径、性能权衡及落地实践。

Mysssone的博客 212

基于 Simulink 的固态变压器(SST)多级协同控制实战教程

《固态变压器多级协同控制仿真指南》摘要: 本教程详细讲解了基于Simulink的固态变压器(SST)三级架构建模与控制方法。核心内容包含:1)搭建级联H桥整流(CHB)、双有源桥(DAB)和逆变器(VSI)的三级主电路;2)提出创新的多级协同控制策略,通过功率前馈实现输入输出级动态匹配;3)给出系统级功率平衡、单元级均压控制的具体实现方案。教程特别强调解决实际工程中的关键问题:代数环处理、软启动设计和刚性系统求解器选择,并提供了硬件在环(HIL)仿真建议。附带的MATLAB代码示例可直接用于实现电容电压均衡

xiaoheshang_123的博客 120

我用 GPUWorks 在 M1 Pro 上搭了个发票识别原型

公司里经常要看电子发票。我想先做个小原型:把 PDF 发给一个自己部署的图文模型,让它提取发票类型、日期、交易双方和金额,再把结果交给同事核对。这个原型不用先接财务系统,先看看从部署到调用要走多少步,模型返回的内容能不能帮上忙。

鸽芷咕的博客 2万+

高通8155源码下载与Android源码编译

一.下载代码 高通下载源码位置: Qualcomm CreatePoint 注册账号,然后登入 可以先选择edit -> infotainment -> sa8155 -> favorites, 点击View TOC就可以过滤出sa8155所有的信息目录.如下图 拉取代码链接在ChipCode中,点击进去可以看到所有的基线版本,选择你需要下载的版本点进去,如sa8155p-la-1-0_ap_standard_oem,把高通专有代码和开源代码都下载到本机. 1..

Johnny2004的专栏 7675

ADT MCP Server 把 ABAP 开发带进 Agent 模式

今天讨论 ADT MCP Server,不能只把它看成 Visual Studio Code 里多出来的一个开关。它真正有意思的地方,在于它把 ABAP 后端开发里那些原本需要手工点击、手工创建、手工激活、手工查服务元数据的动作,包装成一组可以被 GitHub Copilot 这类 coding agent 调用的工具。SAP 在 RAP130 练习里把它描述为运行在 ADT for Visual Studio Code 扩展内部的本地 HTTP Server,它实现的是 Model Context Pro

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 184

您您这可以把问小白的多个会话比如说。左侧的多个会话一次性导出吗?不是单条会话里面的多次会对话。AI导出鸭

第三层是格式编译层。这个决策背后的判断很清晰:一个批量导出工具的价值,不在于“试三次”,而在于你真正用它处理了几十份技术文档、访谈记录或课程讲义之后,它是否值得留在你的工作流里。问小白的会话列表通过分页接口加载,AI导出鸭 在页面运行时建立旁路监听,捕获每一次分页请求返回的完整对话清单,包括会话 ID、标题、时间戳和隐藏的元数据字段。让AI导出回归优雅——这句话说的是:导出不该是体力活,而应该是一次完整的、可预期的文件交付。注意:这里的“批量”指的是左侧列表里的多个独立会话,不是一条会话内的多轮对话。

laoyunsi的博客 244

SPMI协议学习总结

SPMI(System Power Management Interface)是由MIPI(Mobile Industry Processor Interface)联盟定义的一种硬件接口标准,它主要用于移动设备中,连接SoC(System on Chip)处理器系统的集成电源控制器与一个或多个电源管理IC(PMIC),以实现精确的电源管理

歌颂苦难的行为是无耻的; 1082

【从零理解 Spring AI · 12】MCP 的两种角色:做客户端还是做服务端

上一篇讲了 MCP 的概念:标准协议、三大角色、M+N 替代 M×N。

nice_lcj520的博客 498

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

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

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

河道漂浮物目标检测数据集

目标检测,yolo,河道漂浮物目标检测数据集

DL_data_set的博客 198

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

AI Agent之核心框架

A: 显式 Thought 有三类价值:可解释性(便于人类审计)、可调试性(定位哪一步选错工具)、学习信号(可做监督微调或评估中间步骤质量)。ReAct 把推理与 可执行行动 绑定,每一步行动后都有 真实 Observation 反馈,从而用工具结果约束生成,降低闭卷幻觉。做完不等于结束——还要 评估做得好不好,把 教训 记下来,下次 带着教训重试,反思作为 记忆,影响后续尝试的策略。工作流程:Action → Evaluation → Reflection → Retry。A: 普通 CoT 只在。

剑雨巍巍的博客 196

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

AI 应用开发工程师技术实践:大模型接入、通用组件封装与性能优化

本文提出AI应用从PoC到生产的核心挑战:模型调用的持续可用、可控与可优化。通过构建统一LLM网关实现多供应商路由与故障转移,封装对话、工具调用与RAG组件以解耦业务逻辑,结合前缀缓存、批处理与流式背压治理等性能优化手段,形成“接通→接稳→接快”的工程路径,最终以工程化能力决定AI应用的生产可用性。

2301_79189962的博客 551

AI前沿日报 · 2026-11-04 | 祛魅时刻:Astra“纯读权重“神话的崩塌

①Astra"裸权重通吃"被spaCy创始人Honnibal精准祛魅——仅1/3实验真裸读,数学能力提升依赖Python+50次迭代;②Simon Willison用Qwen 3.8-27B端侧复现权重空间编程;③Nvidia开源Auto-Ontology自动知识图谱;④$800开源全域抓取机器人Stringman;⑤OpenAI悄然重开Codex训练开关引信任危机;⑥DeepMind发布Gemini 4 Argon机器人基础模型;⑦美国科技巨头隐性AI债务达3.2万亿美元,6个月增90%。

johnsong2009的博客 568

大模型 Embedding 与向量相似度详解

Embedding 解决的问题:计算机不懂文字,但懂数字│▼文本 → 向量(1024维浮点数数组)│▼相似度解决的问题:怎么判断两个向量(文本)有多接近│▼余弦相似度:看向量方向的夹角,越接近0°越相似│▼最终效果:语义搜索——理解意思,而非字面匹配一句话总结:Embedding 把文字变成数字,余弦相似度比较数字的方向,两者结合实现了"理解语义"的搜索。

T3165919332的博客 86

GPT-1 架构和计算细节

下面配合框图,对 GPT-1 的每个组件做公式展开 + 数值实例(配置:12 层 × 768,12 头,FFN 3072,词表 40478,共 117M 参数)。GPT-1 把翻译模型的编码器-解码器砍掉一半,只留解码器,然后以"预测下一个词"为目标在 BooksCorpus 上预训练。与 2017 原版的四个架构差异(框图中标 ★):h0=E[token]+Epos[position],E∈R40478×768, Epos∈R512×768h^0 = E[\text{token}] + E_{pos}[\

eloudy的专栏 278

终端 AI 审计与 “龙虾” 类智能体风险治理:从可见性到闭环溯源

生成式 AI 办公普及之后,数据泄露风险逐步下沉到终端。员工将合同、源代码、客户资料粘贴至公有大模型,以及龙虾(OpenClaw)这类本地开源 AI 智能体的滥用,成为企业安全新挑战。传统网络边界防护存在审计盲区,本文从风险链路拆解、核心能力模型、分级治理策略、落地踩坑点以及技术局限性多角度,分享终端侧 AI 安全治理的实践思路。

2401_86491085的博客 636

2.53 基于极稀疏指纹的室内定位注意力图元学习

该论文发表于IEEE Transactions on Mobile Computing(TMC)2026年6月,面向极稀疏指纹条件下的WiFi室内定位,针对指纹采集人力成本高、标记指纹稀缺时定位精度大幅下降的痛点,提出注意力图元学习模型AGML(Attentional Graph Meta‑Learning),结合图神经网络、元学习、两种指纹数据增强与分布对齐技术,在标记指纹极少的场景实现高精度室内定位,同时公开了多套真实+仿真定位数据集用于基准测试。场景:二维室内空间,障碍物造成信号遮挡,

weixin_42963026的博客 334

语音识别与语音合成的技术原理及应用

语音识别 #语音合成 #人工智能 #大模型。语音识别与语音合成的技术原理及应用。一、语音识别的核心原理。二、语音合成的核心原理。三、工程落地的主要难点。五、需要关注的现实问题。

weixin_62919816的博客 207

设计师工作室 GEO 实操:如何提升 AI 实体推荐概率

设计工作室 GEO 的本质,是把创意服务转化为 AI 可理解的结构化信息。核心动作可归纳为:区分事实与审美、建立实体图谱、预判用户提问、输出脱敏内容、搭建多信源、持续测试验证。梳理工作室的 6 个实体属性:品类、城市、流程、边界、团队、渠道。在官网或作品集平台发布至少 3 篇结构化项目复盘,只陈述事实。输出 1 篇「设计报价影响因素」科普内容,覆盖甲方高频提问。争取 1 次行业媒体或本地媒体专访,形成第三方信源。每周用「XX 城市 + 品类 + 设计工作室推荐」指令测试,记录出现频率。

goujunwe的博客 335

AI作图软件技术选型:从4个技术维度出发的实测对比

AI作图软件技术选型:从4个技术维度出发的实测对比

Vbaoke的博客 202

WorkBuddy 实战:一句话需求 → 七屏可交互原型,户外徒步 App 的 AI 设计全流程

WorkBuddy 实战:一句话需求 → 七屏可交互原型,户外徒步 App 的 AI 设计全流程,跟着博主一起来还原整个过程。

夜郎King的博客 4581
上一篇: 命题公式的范式python
下一篇: CS360 Machine Learning Final Competition
todcode
博客等级 码龄7年 359粉丝 108原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值