问题标签 [interface-design]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
167 浏览

r - CEDesign中的Clogit函数不收敛

我使用包 support.CEs 设计了一个 CE 实验。我生成了一个带有 3 个属性的 CE 设计,每个属性有 4 个级别。问卷有 4 个备选方案和 4 个块

问卷由 15 人(ID 1-15)回答,因此有 60 个输出(每 4 个区块有 15 人回答:

问题是,当我将问题和答案矩阵与公式合并时

R 显示警告消息: In fitter(X, Y, strats, offset, init, control, weights = weights, : Ran out of iterations and didn't convergence

我应该期望生成的矩阵 desmat1 有 4800 个观察值(80 个可能的组合和 60 个输出)。相反,我只有 1200 次观察。矩阵数据集 1 仅显示 1 组备选方案的组合,而不是 4 组。

例如,对于 ID 1,块 1,问题 1 仅出现替代 1。它与该人选择的答案匹配,但在其他情况下不匹配,并且该信息在 R 中丢失,因此 clogit 时的结果是应用是错误的。

我确实希望这些问题得到理解。问候,

版:

我发现了我的问题。当我从我以 .csv 格式生成的 respondent.dataset 制作数据集时,r 只检测到 q1 响应而不是 q1-q4。数据集1

将 q1-q4 检测为新列。但关键是 q1-q4 必须填充 dataset1 中的 QES 列。我之前用 1 个块做了另一个 CE,并且数据集在读取 respondant.dataset 时正确完成。所以关键是现在我使用了 4 个块,但我不知道如何让 R 解释 q1-q4 是每个块的列 QUES。

res1 矩阵(repondant.dataset)(完整的矩阵有 60 行 = 15 名受访者(ID 1-15)* 4 个问题(make.dataset 中的 QES 列)

在此处输入图像描述

亲切的问候,

0 投票
0 回答
63 浏览

c# - C# 界面设计

我正在尝试为应该具有启动、停止、恢复等方法的服务定义接口。

但是有些服务可以是异步的,需要异步实现相同的方法(启动、停止和恢复)。这里还有一个警告是异步方法也接受cancellationToken

问题 某些服务可以启动异步并停止同步。遵循ISP(接口隔离原则)。如果我们创建一个可消耗的接口,即

正如我们在上面看到的,它需要创建太多各种组合的接口。

有没有更好的设计方法,相对简单且可维护?

0 投票
1 回答
46 浏览

python-3.x - Augment a Python enum with a value taking parameters

I have a Python enum:

It is part of a public interface, people pass E.A or E.B to various functions to specify some parameter. I want to augment this enum to add a third value, C, but this value only makes sense if you also pass a couple of additional parameters, x and y. So in addition to allowing my users to pass E.A or E.B, I want them to be able to pass e.g. E.C(x=17,y=42), and have my code access the values of these parameters (here, 17 and 42).

What's the most "pythonic" way of achieving this? I'm using Python 3.7.