MATLAB Fundamentals>>Representing Discrete Categories

这篇具有很好参考价值的文章主要介绍了MATLAB Fundamentals>>Representing Discrete Categories。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

MATLAB Fundamentals>Specialized Data Types>Representing Discrete Categories>(1/6) Introduction

Representing Discrete Categories

When text labels are intended to represent a finite set of possibilities, a string array may use more memory than a categorical array. There are functions designed to work with categories of data, so if your text describes a group or category, this is often the best data type.
当文本标签旨在表示一组有限的可能性时,字符串数组可能比分类数组使用更多的内存。有些函数是为处理数据类别而设计的,因此,如果您的文本描述了一个组或类别,这通常是最好的数据类型

MATLAB Fundamentals>Specialized Data Types>Representing Discrete Categories>(2/6) Converting to and Operating on Categoricals

This code sets up the activity.

x = ["C","B","C","A","B","A","C"]

This line of code would produce an error.

% histogram(x)

说明1:You can convert a string array to a categorical using the categorical function.

任务1:Convert x into a categorical array named y.

解答:

y = categorical(x)

说明2:Categorical arrays take up less memory than cell arrays of strings.

任务2:Issue the whos x y command to see how much memory each variable uses.

解答:

whos x y

任务3:

You can see the categories represented in a categorical array using the categories function on the categorical array.

解答:

cats = categories(y)

任务4:

Create a variable named iC which contains values of true corresponding to the values in y that equal C.

解答:

iC = y == "C"

任务5:

Create a variable named iNB which contains values of true corresponding to the values in y that are not equal to B.

解答:

iNB = y ~= "B"

附加练习:Try indexing into y with iC and iNB.

解答:

iCidx = y(iC)
iNBidx = y(iNB)

笔记:

(1)a string array may use more memory than a categorical array字符串数组比分类数组占用更多内存;

(2)任务4和5后面部分可以不使用括号,执行运算顺序为从又向左,即先计算“等于”或“不等于”逻辑,在将结果赋值给左边变量。文章来源地址https://www.toymoban.com/news/detail-802142.html

到了这里,关于MATLAB Fundamentals>>Representing Discrete Categories的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 4-2 3D images: Volumetric data & Representing tabular data

    本文所用到的资料下载地址 By stacking individual 2D slices into a 3D tensor, we can build volumetric data representing the 3D anatomy of a subject. We just have an extra dimension, depth, after the channel dimension, leading to a 5D tensor of shape N × C × D × H × W. N 表示样本(图片)的数量 C 表示特征通道的数量 D 表示深度

    2024年02月16日
    浏览(35)
  • 离散数学笔记Discrete Mathematics

    ------------------------------------------------------------------- Design By 2100301629王家寧 1.集合的运算 ①补运算 ②对称差运算 2.集合运算的性质 ①集合运算的基本恒等式 (可用文氏图进行相关推导) 重点记忆德摩根律和补交转换律 ⑩和⑪ 德摩根律:补集分配进括号里面就把括号里面的

    2023年04月08日
    浏览(27)
  • 详解VQVAE:Neural Discrete Representation Learning

    VQVAE:Neural Discrete Representation Learning 原文链接:https://arxiv.org/abs/1711.00937  要看细节,强推,直接不用看论文了: VQ-VAE的简明介绍:量子化自编码器 - 科学空间|Scientific Spaces 一、问题提出 一些具有挑战性的任务,如few-shot learning,严重依赖从原始数据学习的表示,但在无监督

    2024年02月14日
    浏览(34)
  • 论文笔记DIGRESS: DISCRETE DENOISING DIFFUSION FORGRAPH GENERATION

            一些扩散模型的文章: https://zhuanlan.zhihu.com/p/640138441 https://blog.csdn.net/qq_43505867/article/details/130983606 https://blog.csdn.net/qq_51392112/article/details/129326444 目录 Abstract 1 Introduction 2 Diffusion models 3 DISCRETE DENOISING DIFFUSION FOR GRAPH GENERATION 3.1迭代过程与逆去噪迭代 3.2去噪网络参数

    2024年02月04日
    浏览(34)
  • python 入门基础 Introduction to Python Fundamentals

    注释 单行注释 多行注释 pass 补充语法的完整性,什么都不做 字符串格式化 format % f-string(py3.6之后可用) 数据结构 数据类型的转换:目标类型(值),如int(‘1’),将浮点值转换为整型值会丢失精度 在函数中修改全局变量的值需要用 global 再次声明全局变量,以表明修改

    2024年01月16日
    浏览(36)
  • Policy Iteration Adaptive Dynamic Programming Algorithm for Discrete-Time Nonlinear Systems

    本文是第一次对离散非线性系统采用策略迭代的方法分析收敛性和稳定性。反复实验获得 初始的可容许控制策略 ,迭代值函数是单调不增,收敛到HJB方程的最优值。证明任意迭代控制策略使非线性系统稳定。神经网络近似值函数和求最优控制,且分析权重矩阵的收敛性。 根

    2024年03月22日
    浏览(35)
  • Hack The Box -SQL Injection Fundamentals Module详细讲解中文教程

    数据库介绍............................................................................................................... 3 数据库管理系统(DBMS)介绍........................................................................... 3 数据库的类型..................................................................................................

    2024年02月04日
    浏览(25)
  • 数字逻辑Fundamentals of Digital Logic with Verilog Design | 3rd Edition Solutins Chapter 4(step by step)

    第四章 重要内容:1、多路选择器  2、采用香农展开的多路选择器综合 3、译码器  4、多路分配器  5、优先级编码器  6、代码转换器  7、算数比较电路  8、Verilog语法 纠错:4-11香农展开式最后结果应该是同或门。 Chapter 4 Chapter 4, Problem 1P Chapter 4, Problem 2P Chapter 4, Problem 3P

    2024年02月05日
    浏览(29)
  • MATLAB入门教程||MATLAB位运算||MATLAB集合操作

    MATLAB提供位运算 ,如\\\'位\\\',\\\'位或\\\'和\\\'位不操作,移位操作等各种函数 以下的表格显示了常用的按位运算: 函数 目的/作用 bitand(a, b) 整数a和b的逐位AND bitcmp(a) a的位补码 bitget(a,pos) 在指定位置pos中获取位,在整数数组A中 bitor(a, b) 整数a和b的逐位OR bitset(a, pos) 在某一位置上设置

    2024年02月07日
    浏览(36)
  • 光速上手matlab入门级学习必看matlab超长细练习matlab,福利分享Matlab全套资料

    实践是检验知识和技能的唯一标准。只有将所学的知识应用到实际问题中,并通过实践不断地调整和完善,才能真正掌握和理解这些知识。 在 MATLAB 中,可以通过编写代码、运行程序、调试错误等方式进行实践。例如,可以尝试解决实际问题,如数据分析、信号处理、图像处

    2024年02月09日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包