编程任务第3周,机器学习,Andrew-ng,Coursera
系统:Ubuntu 16.04
Octave 4.0.0
问题:无法将代码提交给服务器.此代码已成功从Windows环境提交.
octave:1> submit
== Submitting solutions | Logistic Regression...
Login (email address): *************
Token: ************
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 983 100 25 100 958 11 436 0:00:02 0:00:02 --:--:-- 437
error: structure has no member 'message'
error: called from
submitWithConfiguration at line 35 column 5
submit at line 40 column 3
error: evaluating argument list element number 2
error: …
Run Code Online (Sandbox Code Playgroud) 我使用的是Mac OS El Capitan 10.11.5
安装VirtualBox 5.0.24
Genymotion 2.7.2
崩溃报告中的文字
Process: genymotion [1051]
Path: /Applications/Genymotion.app/Contents/MacOS/genymotion
Identifier: com.yourcompany.genymotion
Version: ???
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: genymotion [1051]
User ID: 501
Date/Time: 2016-07-03 10:38:17.680 +0300
OS Version: Mac OS X 10.11.5 (15F34)
Report Version: 11
Anonymous UUID: 890BAC95-7988-7846-0ECE-0DEC8BFB2C9E
Sleep/Wake UUID: 10886C01-28E6-49CC-B63D-2AA32EEC3A87
Time Awake Since Boot: 6500 seconds
Time Since Wake: 3700 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: …
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个子图的图形.我不希望子图有传说,而是想要有一个整体传说.
我读到可以通过仅向最后一个子图添加图例并通过position
特征legend
或通过使用一个子图图形位置调整其在图中的位置(例如subplot(2,3,5.5)
仅用于显示图例).我更喜欢第二种选择,虽然直到现在我还没有成功.有帮助吗?
这是我的代码:
SLS=figure();
hold on
subplot(3,2,1);
plot(t,u{1},t,u{2},t,u{3},t,u{4},t,u{5},t,u{6});
title('SLS Levels');
subplot(3,2,2);
plot(t,log_u{1},t,log_u{2},t,log_u{3},t,log_u{4},t,log_u{5},t,log_u{6});
title('SLS Logarithms');
subplot(3,2,3);
plot(t,I_u{1},t,I_u{2},t,I_u{3},t,I_u{4},t,I_u{5},t,I_u{6});
title('SLS Levels with Intercept');
subplot(3,2,4);
plot(t,log_I_u{1},t,log_I_u{2},t,log_I_u{3},t,log_I_u{4},t,log_I_u{5},t,log_I_u{6});
title('SLS Log. with Intercept');
subplot(3,2,5.5);
legend('GDP', 'C', 'I', 'G', 'Imp.', 'Exp.');
axis off
Run Code Online (Sandbox Code Playgroud) 我需要在python中将图像从CMYK转换为RGB.我用这种方式使用Pillow:
img = Image.open('in.jpg')
img = img.convert('RGB')
img.save('out.jpg')
Run Code Online (Sandbox Code Playgroud)
该代码有效,但如果我用Photoshop转换相同的图像,我会得到不同的结果,如下所示: -
在photoshop中完成的唯一操作是将方法从CMYK更改为RGB.为什么两个RGB图像之间存在这种差异?它可能是颜色配置文件问题?
我需要阻止特定的绘图条目显示在Matlab绘图图例上.
样品:
% x and y are any plot data
for i=1:5
plot(x,y);
plot(x2,y2,'PleaseNoLegend!'); % I need to hide this from legend
end
legend('show');
Run Code Online (Sandbox Code Playgroud)
我可以在plot命令中设置任何标志,这样这个特定条目不会出现在图例中吗?
在尝试定义我自己的随机生成器函数时,我得到未定义的变量/参数.
码:
function result = myrand(n, t, p, d)
a = 200 * t + p
big_rand = a * n
result = big_rand / 10**d
return;
endfunction
mrand = myrand(5379, 0, 91, 4)
Run Code Online (Sandbox Code Playgroud)
错误:
>> myrand
error: 't' undefined near line 2 column 15
error: called from
myrand at line 2 column 7
Run Code Online (Sandbox Code Playgroud) 给定一个矩阵: -
k = [1 2 3 ;
4 5 6 ;
7 8 NaN];
Run Code Online (Sandbox Code Playgroud)
如果我想用0替换一个数字,比如2,我可以使用:k(k==2) = 0
.它工作正常,并给出以下预期答案: -
k =
1 0 3
4 5 6
7 8 NaN
Run Code Online (Sandbox Code Playgroud)
但是,如果我尝试替换NaN
,为什么这不起作用,即k(k==NaN) = 0
给出:
k =
1 2 3
4 5 6
7 8 NaN
Run Code Online (Sandbox Code Playgroud)
虽然我能够使用以下方法获得所需的结果:k(isnan(k))=0
.但为什么第一种方法不起作用?
我在MATLAB中绘制一个水平箱图 - boxplot(y, group,'orientation','horizontal')
然后使用隐藏y轴set(gca,'box','off','ycolor','w')
.
它在屏幕上看起来很好 - 只有底部的x轴可见.但是每当我将图形保存到文件时,使用print()
函数或matlabfrag.m
,左边的y轴重新出现在输出文件中(尽管它没有显示在MATLAB的图形可视化中).
如何隐藏这个Y轴?
我有两个矩阵:
A = [1 2;
3 4;
5 6]
B = A'
Run Code Online (Sandbox Code Playgroud)
乘法应该采用从两者中提取行和列向量的方式.
C = B(:,i) * A(i,:)
这样,对于第一个实例(第1行和第1列),结果将是:
[1 2;
2 4]
Run Code Online (Sandbox Code Playgroud)
这将被垂直总结以获得[3 6]
.这笔款项将给出最终答案9
.同样,如果矩阵尺寸较大,则第2行和第2列,第3行和第3列等.
此最终标量值将用于比较哪一行及其相应列具有高产量.
我正在尝试进行一些数据分析,其想法是使用autobinning
命令创建最佳箱柜,计算每个箱柜的WOE(证据权重)值,然后用相应的WOE值替换属于每个箱柜的原始值.以下是我的工作:
CreSC = creditscorecard(Data_Table ,'IDVar','CustID','GoodLabel',0);
scAB = autobinning(CreSC,'Algorithm','Monotone');
DataTransformed = bindata(scAB,t_Data,'OutputType','WOE');
Run Code Online (Sandbox Code Playgroud)
问题是上述过程不考虑NaN
DATA中的值并自动排除它们.
我的目标是仅为NaN
值创建一个单独的bin,并强制autobinning
命令考虑这些NaN
值.
有没有人有合理的解决方案?