我知道如何在90年代末和21世纪初编写html.它已经过了地理时代,所以我的技能不是那么古老/糟糕.我可以很好地写老派的HTML和CSS,但我已经失去了与趋势的联系.
例如,如果你告诉我从photoshop模型中设计一个页面,我仍然可以先使用表格进行布局,然后使用colspan和rowspan将内容插入到单元格中.我设计的菜单将再次成为一个子表格,而不是具有花哨css的ul.等等.我在新网站上看到的一些东西让我大吃一惊.
但每当我试图寻找资源来学习时,我会发现两种:
两者都不适合我.我知道,我可能是一个相当小众的观众,但对于像我这样的人有什么东西吗?如果没有,我可以得到一些指针吗?
最好是关注设计元素的东西(不是语法,不是美学)
(如果这不是这样的问题的正确论坛,请告诉我)
我正在训练两个SVM模型,在我的数据上使用两个不同的包,并得到截然不同的结果.这是预期的吗?
library('e1071')
model1 <- svm(myFormula, data=trainset,type='C',kernel='linear',probability = TRUE)
outTrain <- predict(model1, trainset, probability = TRUE)
outTest <- predict(model1, testset, probability = TRUE)
train_pred <- attr(outTrain, "probabilities")[,2]
test_pred <- attr(outTest, "probabilities")[,2]
calculateAUC(train_pred,trainTarget)
calculateAUC(test_pred,testTarget)
Run Code Online (Sandbox Code Playgroud)
model2 <- train(myFormula,data=trainset,method='svmLinear')
train_pred <- predict(model2, trainset)
test_pred <- predict(model2, testset)
calculateAUC(train_pred,trainTarget)
calculateAUC(test_pred,testTarget)
Run Code Online (Sandbox Code Playgroud)
calculateAUC()是给定目标的预测值和实际值,我定义的函数来计算AUC值.我认为价值观为:
1
0.8567979
0.9910193
0.758201
这是可能的吗?或者我做错了吗?
我可以提供样本数据,如果这将有所帮助
我正在使用python的colorsys库将RGB颜色值转换为HLS.为了验证,我尝试转换回RGB并获得不同的值.由于精度问题,我可以理解微小的差异,但这些值明显不同.
这是我的代码:
import colorsys
r=192
g=64
b=1
hlsval = colorsys.rgb_to_hls(r,g,b)
rgbval=colorsys.hls_to_rgb(hlsval[0],hlsval[1],hlsval[2])
print hlsval, rgbval
Run Code Online (Sandbox Code Playgroud)
输出:
(0.16666666666666666, 96.5, -1.0) (191.99999999999994, 192.0, 1.0)
Run Code Online (Sandbox Code Playgroud)
绿色值超过200%
我尝试了其他一些值,并且每次其中一个组件都会大量关闭.我错过了什么吗?
使用tm包我可以这样做:
c0 <- Corpus(VectorSource(text))
c0 <- tm_map(c0, removeWords, c(stopwords("english"),mystopwords))
Run Code Online (Sandbox Code Playgroud)
mystopwords 是我要删除的附加停用词的向量.
但我找不到使用RTextTools包的等效方法.例如:
dtm <- create_matrix(text,language="english",
removePunctuation=T,
stripWhitespace=T,
toLower=T,
removeStopwords=T, #no clear way to specify a custom list here!
stemWords=T)
Run Code Online (Sandbox Code Playgroud)
是否有可能做到这一点?我真的很喜欢这个RTextTools界面,很遗憾必须回到原点tm.
我有一些预测变量和二进制目标的数据.例如:
df <- data.frame(a=sort(sample(1:100,30)), b= sort(sample(1:100,30)),
target=c(rep(0,11),rep(1,4),rep(0,4),rep(1,11)))
Run Code Online (Sandbox Code Playgroud)
我使用了一个logistic regresion模型 glm()
model1 <- glm(formula= target ~ a + b, data=df, family=binomial)
Run Code Online (Sandbox Code Playgroud)
现在我正在尝试预测输出(例如,相同的数据应该足够)
predict(model1, newdata=df, type="response")
Run Code Online (Sandbox Code Playgroud)
这生成概率数的向量.但我想预测实际的课程.我可以在概率数上使用round(),但这假设低于0.5的任何东西都是'0'类,而上面的任何东西都是'1'类.这是正确的假设吗?即使每个阶级的人口可能不相等(或接近相等)?或者有没有办法估算这个门槛?
我有一个数据框image.rgb,我已经为其中的每个坐标加载了r,g,b值(使用jpeg和reshape包).它现在看起来像:
> head(image.rgb)
y x r g b
1 -1 1 0.1372549 0.1254902 0.1529412
2 -2 1 0.1372549 0.1176471 0.1411765
3 -3 1 0.1294118 0.1137255 0.1176471
4 -4 1 0.1254902 0.1254902 0.1254902
5 -5 1 0.1254902 0.1176471 0.1294118
6 -6 1 0.1725490 0.1372549 0.1176471
Run Code Online (Sandbox Code Playgroud)
现在我想用ggplot2绘制这个'图像'.我可以绘制一个特定的"通道"(红色或绿色或蓝色),一个在使用时间:
ggplot(data=image.rgb, aes(
x=x, y=y,
col=g) #green for example
) + geom_point()
Run Code Online (Sandbox Code Playgroud)
...在默认的ggplot2色标上
有没有办法指定可以从我指定的列中获取确切的rgb值?
使用包中的plot功能base,我可以使用
with(image.rgb, plot(x, y, col = rgb(r,g,b), asp = 1, …Run Code Online (Sandbox Code Playgroud)