GVKun编程网logo

将“ 10yrs 5mon”的分类值转换为月

26

在本文中,您将会了解到关于将“10yrs5mon”的分类值转换为月的新资讯,并给出一些关于brmshurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗?

在本文中,您将会了解到关于将“ 10yrs 5mon”的分类值转换为月的新资讯,并给出一些关于brms hurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗?、CastError:模型“ admin”的路径“ _id”处的值“ favicon.ico”的强制转换为ObjectId、javascript-将“视场”值转换为CSS3D透视值、php – 如何将数组第一个值转换为键,将第二个值转换为值的实用技巧。

本文目录一览:

将“ 10yrs 5mon”的分类值转换为月

将“ 10yrs 5mon”的分类值转换为月

将列转换为数值作为预处理

Aging
'10yrs 1mon'
'9yrs 8mon'
'25yrs 5mon'

预期:

'10yrs 1mon'     121
'9yrs 8mon'      116
'25yrs 5mon'     305

brms hurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗?

brms hurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗?

如何解决brms hurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗??

我有一个零膨胀的y变量。

能否请您确认我的解决方案,以将brms跨栏对数正态后验值转换为有意义的估计值,例如y变量单位(对数正态部分)或零概率(跨栏部分)。

模型

model = brm(br(y ~ (1 | county),hu ~ (1 | county),data = data,family = hurdle_lognormal())

后验变量

get_variables(model)

 [1] "b_Intercept"                  
 [2] "b_hu_Intercept"               
 [3] "sd_county__Intercept"         
 [4] "sd_county__hu_Intercept"      
 [5] "sigma"     
                   
 [6] "r_county[A,Intercept]"     
 [7] "r_county[B,Intercept]"    
 [8] "r_county[C,Intercept]"    
 [9] "r_county[D,Intercept]"  
   
[10] "r_county__hu[A,Intercept]"  
[11] "r_county__hu[B,Intercept]"  
[12] "r_county__hu[C,Intercept]"  
[13] "r_county__hu[D,Intercept]" 

[14] "lp__"                         
[15] "accept_stat__"                
[16] "stepsize__"                   
[17] "treedepth__"                  
[18] "n_leapfrog__"                 
[19] "divergent__"                  
[20] "energy__" 

每个县的平均y值计算解决方案

我必须添加“ b_Intercept”和“ r_county [,Intercept]”,并采用exp()?在代码中:

model %>%
  spread_draws(b_Intercept,r_county[county,]) %>%
  median_qi(condition_mean = exp(b_Intercept + r_county))

每个县计算零概率(y = 0)的解决方案

我必须添加“ b_hu__Intercept”和“ r_county__hu [,Intercept]”,并将其放入inv_logit_scaled()函数中吗?在代码中:

m %>%
  spread_draws(b_hu_Intercept,r_county__hu[county,]) %>%
  median_qi(condition_mean = inv_logit_scaled(b_hu_Intercept + r_county__hu))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

CastError:模型“ admin”的路径“ _id”处的值“ favicon.ico”的强制转换为ObjectId

CastError:模型“ admin”的路径“ _id”处的值“ favicon.ico”的强制转换为ObjectId

如何解决CastError:模型“ admin”的路径“ _id”处的值“ favicon.ico”的强制转换为ObjectId?

更新我的node.js后出现此错误。我在路由器中收到此错误,如果我删除该路由器,该错误消失了 另外,如果我重新添加路由器,我不会收到错误 除非我重新启动系统或重新启动chrome。

D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:4371
  const castError = new CastError();
                    ^

CastError: Cast to ObjectId Failed for value "favicon.ico" at path "_id" for model "admin"
    at model.Query.exec (D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:4371:21)
    at model.Query.Query.then (D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:4463:15)
    at processticksAndRejections (node:internal/process/task_queues:93:5)
    at runNextTicks (node:internal/process/task_queues:62:3)
    at processImmediate (node:internal/timers:435:9) {
  messageformat: undefined,stringValue: ''"favicon.ico"'',kind: ''ObjectId'',value: ''favicon.ico'',path: ''_id'',reason: Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
      at new ObjectID (D:\raghav\web\ecommerce\node_modules\bson\lib\bson\objectid.js:59:11)
      at castObjectId (D:\raghav\web\ecommerce\node_modules\mongoose\lib\cast\objectid.js:25:12)
      at ObjectId.cast (D:\raghav\web\ecommerce\node_modules\mongoose\lib\schema\objectid.js:267:12)
      at ObjectId.SchemaType.applySetters (D:\raghav\web\ecommerce\node_modules\mongoose\lib\schematype.js:1072:12)
      at ObjectId.SchemaType._castForQuery (D:\raghav\web\ecommerce\node_modules\mongoose\lib\schematype.js:1507:15)
      at ObjectId.SchemaType.castForQuery (D:\raghav\web\ecommerce\node_modules\mongoose\lib\schematype.js:1497:15)
      at ObjectId.SchemaType.castForQueryWrapper (D:\raghav\web\ecommerce\node_modules\mongoose\lib\schematype.js:1474:20)
      at cast (D:\raghav\web\ecommerce\node_modules\mongoose\lib\cast.js:331:32)
      at model.Query.Query.cast (D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:4772:12)
      at model.Query.Query._castConditions (D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:1872:10)
      at model.Query.<anonymous> (D:\raghav\web\ecommerce\node_modules\mongoose\lib\query.js:2129:8)
      at model.Query._wrappedThunk [as _findOne] (D:\raghav\web\ecommerce\node_modules\mongoose\lib\helpers\query\wrapThunk.js:16:8)
      at D:\raghav\web\ecommerce\node_modules\kareem\index.js:369:33
      at processticksAndRejections (node:internal/process/task_queues:75:11)
      at runNextTicks (node:internal/process/task_queues:62:3)
      at processImmediate (node:internal/timers:435:9)
}

从我的app.js中删除此路由器后,我就没有收到错误消息,如果我重新添加此路由器,则我没有收到任何错误消息(重启系统后,我会再次收到此错误消息)>

const productOutputControllers = require(''../controllers/productOutputControllers'');
const router = require(''express'');


const app = router();

app.get(''/:id'',productOutputControllers.product_get);

app.get(''/product/:id'',productOutputControllers.productDetails_get);
module.exports = app;

控制器的代码是

const Product = require(''../model/product'');
const adminTypes = require(''../model/admin'');
const jwt = require(''jsonwebtoken'');
const User = require(''../model/user'');

module.exports.product_get = async (req,res)=>{
const typeID = req.params.id;
let type,product;

type = await adminTypes.findById(typeID);
Product.find({type:type.type})
.then(result =>{
  product = result;
  res.render(''product'',{title:''Mouse'',product});
})
.catch(err =>{
console.log(err,"productOP");
});
 };

 module.exports.productDetails_get = async (req,res) =>{
   let same,a,userId;
   const id = req.params.id;
   if(req.cookies.buyer){
    let token = req.cookies.buyer;
    jwt.verify(token,''Ecommerce secret'',(err,decodedToken) =>{
    if(err){
      console.log(err,"err");
    }else{
      userId = decodedToken.id;
    } 
    });
    const check = await User.findById(userId);
    check.wishlist.forEach(data =>{
        if(data.productID == id){    
          a = true;   
        }else{
          same = false;
        }
    });
   }else{
     same = false;
   }
    if(a){
      same = true;
    }
    const details = await Product.findById(id);
    res.render(''productDesc'',{details,same});
  };     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

javascript-将“视场”值转换为CSS3D透视值

javascript-将“视场”值转换为CSS3D透视值

如果我想拥有一个视角为60°的相机,那么如何计算CSS3D透视值?

perspective: ?;
perspective-origin: center center;

我已经找到了有关如何从透视值计算投影矩阵的描述,但我仍然不太了解:http://www.w3.org/TR/css-transforms-1/#perspective-matrix-computation

因此,如果我具有给定的视野,并且知道元素的offsetWidth / offsetHeight,那么应该如何计算所需的透视值?

而近平面和远平面在哪里?

解决方法:

几年前我问similar question,下面得到了答复.此后链接的文章已更改,因此我引用了该文本,因为该文本不再存在于该文章中(但可能仍然有其他有用的信息).

如果我正确阅读,则您的金字塔底端距观察者[perspective px].因此,如果您想将视场角设为60°,则从中心到拐角处都有一个30°的三角形,并且需要找到相邻边的长度:

Math.pow( w/2*w/2 + h/2*h/2, 0.5 ) / Math.tan( 30 * Math.PI / 180 )

我认为;)对于1000×500的视图,它产生的视角为968,这与从-webkit-perspective随机播放相当不错

The CSS 3D Transforms Module工作草案给出以下解释:

perspective(<number>)

specifies a perspective projection matrix. This matrix maps a viewing cube onto a pyramid whose base is infinitely far away from the
viewer and whose peak represents the viewer’s position. The viewable
area is the region bounded by the four edges of the viewport (the
portion of the browser window used for rendering the webpage between
the viewer’s position and a point at a distance of infinity from the
viewer). The depth, given as the parameter to the function, represents
the distance of the z=0 plane from the viewer. Lower values give a
more flattened pyramid and therefore a more pronounced perspective
effect. The value is given in pixels, so a value of 1000 gives a
moderate amount of foreshortening and a value of 200 gives an extreme
amount. The matrix is computed by starting with an identity matrix and
replacing the value at row 3, column 4 with the value -1/depth. The
value for depth must be greater than zero, otherwise the function is
invalid.

php – 如何将数组第一个值转换为键,将第二个值转换为值

php – 如何将数组第一个值转换为键,将第二个值转换为值

嗨,我正在进行一些阵列操作.

我需要将数组的第一个值转换为键,将数组的第二个值转换为值.

我有一个变量$testArray,它存储如下所示的数组.

 Array
(
    [0] => Array
        (
            [0] => Color
            [1] => White on Red
        )

    [1] => Array
        (
            [0] => Depicted Text
            [1] => EMPTY
        )

    [2] => Array
        (
            [0] => Depth [Nom]
            [1] => 0.004 in
        )

    [3] => Array
        (
            [0] => Language
            [1] => English
        )

    [4] => Array
        (
            [0] => Length [Nom]
            [1] => 10 in
        )

    [5] => Array
        (
            [0] => Material
            [1] => Adhesive Vinyl
        )

    [6] => Array
        (
            [0] => Mounting
            [1] => Surface
        )

    [7] => Array
        (
            [0] => Width [Nom]
            [1] => 14 in
        )

    [8] => Array
        (
            [0] => Wt.
            [1] => 0.056 lb
        )

)

预期产量:

    Array
(
    [0] => Array
        (
            [Color] => White on Red
        )

    [1] => Array
        (
            [Depicted Text] => EMPTY
        )

    [2] => Array
        (
            [Depth [Nom]] => 0.004 in
        )

    [3] => Array
        (
            [Language] => English
        )

    [4] => Array
        (
            [Length [Nom]] => 10 in
        )

    [5] => Array
        (
            [Material] => Adhesive Vinyl
        )

    [6] => Array
        (
            [Mounting] => Surface
        )

    [7] => Array
        (
            [Width [Nom]] => 14 in
        )

    [8] => Array
        (
            [Wt.] => 0.056 lb
        )

)

我已经尝试过使用数组函数array_keys和array_values,但它无法正常工作

解决方法:

使用array_map功能的简单解决方案:

$result = array_map(function($v){
    return [$v[0] => $v[1]];
}, $testArray);

关于将“ 10yrs 5mon”的分类值转换为月的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于brms hurdle_lognormal模型:这是将后验值转换为y变量单位,并将障碍值转换为概率的正确方法吗?、CastError:模型“ admin”的路径“ _id”处的值“ favicon.ico”的强制转换为ObjectId、javascript-将“视场”值转换为CSS3D透视值、php – 如何将数组第一个值转换为键,将第二个值转换为值的相关信息,请在本站寻找。

本文标签: