楼主: 宽客老丁
4624 20

[其他] Using Modularization to Handle Complex Projects [推广有奖]

  • 5关注
  • 6粉丝

已卖:86份资源

讲师

59%

还不是VIP/贵宾

-

威望
0
论坛币
302458 个
通用积分
384.9155
学术水平
8307 点
热心指数
8320 点
信用等级
8308 点
经验
391881 点
帖子
539
精华
0
在线时间
295 小时
注册时间
2018-12-30
最后登录
2025-12-28

楼主
宽客老丁 发表于 2021-12-18 10:39:53 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
When you start programming in Python, it is very tempting to put all your program
code in a single file. There is no problem in defining functions and classes in the same
file where your main program is. This option is attractive to beginners because of the
ease of execution of the program and to avoid managing code in multiple files. But
a single-file program approach is not scalable for medium- to large-size projects. It
becomes challenging to keep track of all the various functions and classes that you define.
To overcome the situation, modular programming is the way to go for medium to large
projects. Modularity is a key tool to reduce the complexity of a project. Modularization
also facilitates efficient programming, easy debugging and management, collaboration,
and reusability. In this chapter, we will discuss how to build and consume modules and
packages in Python.

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Projects Complex modular Project handle

已有 2 人评分经验 收起 理由
xujingtang + 80 精彩帖子
np84 + 100 精彩帖子

总评分: 经验 + 180   查看全部评分

Don't just fly, soar.

沙发
悟空322 发表于 2021-12-18 17:52:28 来自手机
宽客老丁 发表于 2021-12-18 10:39
When you start programming in Python, it is very tempting to put all your program
code in a single ...
谢谢分享

藤椅
redflame 发表于 2021-12-19 16:38:27
感谢分享

板凳
sdzy 在职认证  学生认证  发表于 2021-12-20 08:59:53

报纸
Myty383 发表于 2022-1-15 03:07:57
it's good to know it.

地板
宽客老丁 发表于 2022-1-19 09:14:13
Supervised vs. Unsupervised
Thefield of machine learning has two major branches—supervised learningand unsupervised learning—and plenty of sub-branches that bridge the two.
In supervised learning, the AI agent has access to labels, which it can use to improve its performance on some task. In the email spam filter problem, we have a dataset of emails with all the text within each and every email. We also know which of these emails are spam or not (the so-called labels). These labels are very valuable in helping the supervised learning AI separate the spam emails from the rest.
In unsupervised learning, labels are not available. Therefore, the task of the AI agent is not well-defined, and performance cannot be so clearly measured. Consider the email spam filter problem—this time without labels. Now, the AI agent will attempt to understand the underlying structure of emails, separating the database of emails into different groups such that emails within a group are similar to each other but different from emails in other groups.
This unsupervised learning problem is less clearly defined than the supervised learning problem and harder for the AI agent to solve. But, if handled well, the solution is more powerful.
Here’s why: the unsupervised learning AI may find several groups that it later tags as being “spam”—but the AI may also find groups that it later tags as being “important” or categorize as “family,” “professional,” “news,” “shopping,” etc. In other words, because the problem does not have a strictly defined task, the AI agent may find interesting patterns above and beyond what we initially were looking for.
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
yunnandlg + 100 + 100 + 5 + 5 + 5 精彩帖子

总评分: 经验 + 100  论坛币 + 100  学术水平 + 5  热心指数 + 5  信用等级 + 5   查看全部评分

7
宽客老丁 发表于 2022-1-19 09:14:45
The Strengths and Weaknesses of Supervised Learning
Supervised learningexcels at optimizing performance in well-defined tasks with plenty of labels. For example, consider a very large dataset of images of objects, where each image is labeled. If the dataset is sufficiently large enough and we train using the right machine learning algorithms (i.e., convolutional neural networks) and with powerful enough computers, we can build a very good supervised learning-based image classification system.
As the supervised learning AI trains on the data, it will be able to measure its performance (via a cost function) by comparing its predicted image label with the true image label that we have on file. The AI will explicitly try to minimize this cost function such that its error on never-before-seen images (from a holdout set) is as low as possible
This is why labels are so powerful—they help guide the AI agent by providing it with an error measure. The AI uses the error measure to improve its performance over time. Without such labels, the AI does not know how successful it is (or isn’t) in correctly classifying images.
However, the costs of manually labeling an image dataset are high. And, even the best curated image datasets have only thousands of labels. This is a problem because supervised learning systems will be very good at classifying images of objects for which it has labels but poor at classifying images of objects for which it has no labels.

8
宽客老丁 发表于 2022-1-19 09:15:12
The Strengths and Weaknesses of Unsupervised Learning
Supervised learningwill trounce unsupervised learning at narrowly defined tasks for which we have well-defined patterns that do not change much over time and sufficiently large, readily available labeled datasets.
However, for problems where patterns are unknown or constantly changing or for which we do not have sufficiently large labeled datasets, unsupervised learning truly shines.
Instead of being guided by labels, unsupervised learning works by learning the underlying structure of the data it has trained on. It does this by trying to represent the data it trains on with a set of parameters that is significantly smaller than the number of examples available in the dataset. By performing this representation learning, unsupervised learning is able to identify distinct patterns in the dataset.
In the image dataset example (this time without labels), the unsupervised learning AI may be able to identify and group images based on how similar they are to each other and how different they are from the rest. For example, all the images that look like chairs will be grouped together, all the images that look like dogs will be grouped together, etc.

9
宽客老丁 发表于 2022-1-19 09:15:42
Data acquisition and exploration
Before we work with the dimensionality reduction algorithms, let’s load the libraries we will use:
# Import libraries'''Main'''importnumpyasnpimportpandasaspdimportos,timeimportpickle,gzip'''Data Viz'''importmatplotlib.pyplotaspltimportseabornassnscolor=snscolor_palette()importmatplotlibasmpl%matplotlibinline'''Data Prep and Model Evaluation'''fromsklearnimportpreprocessingasppfromscipy.statsimportpearsonrfromnumpy.testingimportassert_array_almost_equalfromsklearn.model_selectionimporttrain_test_splitfromsklearn.model_selectionimportStratifiedKFoldfromsklearn.metricsimportlog_lossfromsklearn.metricsimportprecision_recall_curve,average_precision_scorefromsklearn.metricsimportroc_curve,auc,roc_auc_scorefromsklearn.metricsimportconfusion_matrix,classification_report'''Algos'''fromsklearn.linear_modelimportLogisticRegressionfromsklearn.ensembleimportRandomForestClassifierimportxgboostasxgbimportlightgbmaslgb

10
宽客老丁 发表于 2022-1-19 09:16:11
Linear Projection vs. Manifold Learning
Thereare two major branches of dimensionality reduction. The first is known as linear projection, which involves linearly projecting data from a high-dimensional space to a low-dimensional space. This includes techniques such as principal component analysis, singular value decomposition, and random projection
Thesecond is known as manifold learning, which is also referred to as nonlinear dimensionality reduction. This involves techniques such as isomap, which learns the curved distance(also called the geodesic distance) between points rather than the Euclidean distance. Other techniques include multidimensional scaling (MDS), locally linear embedding (LLE), t-distributed stochastic neighbor embedding (t-SNE), dictionary learning, random trees embedding, and independent component analysis

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-7 05:34