How to set the weights of DNN when we have inputs and outputs?

How to set the weight of DNN when we have inputs and outputs?
If we know a sample inputs and outputs of a network how we could find the weight of NN?

All topic

Collision stickyness problem on multiple inputs

I’ve been trying for a couple of days to solve an issue I’m having with top-down 2D collisions, whenever I collide with tiles that have adjacent collidable tiles my player sticks to the wall, If I collide right or left I can’t move up or down, the same for the Y axis, I can’t move left or right when colliding from the top or bottom. Here’s a picture to represent my issue a bit better:

Collision box problems pressing left and up

The gray boxes represent the collision area.

Here is my code:

            Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
            Vector2 temporaryPlayerPosition = player.Sprite.Position - player.Velocity;
            if (player.CollisionBox.Intersects(tileRect))
            {
                if ((player.CollisionBox.Right >= tileRect.Left && player.CollisionBox.Right < tileRect.Right) ||
                    (player.CollisionBox.Left <= tileRect.Right && player.CollisionBox.Right > tileRect.Left))
                {
                    player.CollisionBox.X = (int)temporaryPlayerPosition.X;
                    player.Sprite.Position.X = temporaryPlayerPosition.X;
                }
                if ((player.CollisionBox.Bottom >= tileRect.Top && player.CollisionBox.Bottom < tileRect.Bottom) ||
                    (player.CollisionBox.Top <= tileRect.Bottom && player.CollisionBox.Top > tileRect.Top))
                {
                    player.CollisionBox.Y = (int)temporaryPlayerPosition.Y;
                    player.Sprite.Position.Y = temporaryPlayerPosition.Y;
                }
            }

If anyone could point me to the right direction I would be grateful!! Thanks again!

EDIT!!!

I changed my whole collision code so it does a forward check before handling the displacemente of the sprite, I still have the stickyness issue though. This is the new code:

Rectangle forwardCollision = new Rectangle((int)(player.CurrentPos.X + (player.Velocity.X*4)), (int)(player.CurrentPos.Y + (player.Velocity.Y*4)), player.Sprite.SourceRect.Width, player.Sprite.SourceRect.Height);
player.CanRunX = player.CanRunY = true;
foreach (TmxTile tile in tileList)
{
    tile.Update(gameTime);
    Rectangle tileRect = new Rectangle((int)tile.Position.X, (int)tile.Position.Y, tile.SourceRect.Width, tile.SourceRect.Height);
    if (forwardCollision.Intersects(tileRect) && SolidTileIds.Contains(tile.Id))
    {
        if (player.Velocity.X != 0)
            player.CanRunX = false;
        if (player.Velocity.Y != 0)
            player.CanRunY = false;
    }
}
foreach(DebugRectangle rectangle in rectangleList)
{
    rectangle.Update(gameTime);
}

if (player.CanRunX)
    player.Sprite.Position.X += player.Velocity.X;
else
    player.Sprite.Position.X -= player.Velocity.X;
if (player.CanRunY)
    player.Sprite.Position.Y += player.Velocity.Y;
else
    player.Sprite.Position.Y -= player.Velocity.Y;

player.CurrentPos = player.Sprite.Position;
player.CollisionBox.X = (int)player.Sprite.Position.X;
player.CollisionBox.Y = (int)player.Sprite.Position.Y;
player.DebugRectangle.Position.X = forwardCollision.X;
player.DebugRectangle.Position.Y = forwardCollision.Y;

All topic

How to convert transaction’s inputs to readable values?

I’ve got the following transaction’s input:

{
    name: 'trade',
    types: [
        'address',
        'uint256',
        'address',
        'uint256',
        'uint256',
        'uint256',
        'address',
        'uint8',
        'bytes32',
        'bytes32',
        'uint256'
    ],
    inputs: ['ac709fcb44a43c35f0da4e3163b117a17f3770f5',
        ,
        '0000000000000000000000000000000000000000', 
        , 
        ,
        ,
        'd8eeda4ee2657bb267bc35c1d60babdc5aedd269', 
        ,
        , 
        , 
        
    ]
}

This data came from raw transaction input which is

0x0a19b14a000000000000000000000000ac709fcb44a43c35f0da4e3163b117a17f3770f50000000000000000000000000000000000000000000000878678326eac9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bf2aa184550180000000000000000000000000000000000000000000000000000000000000302bdf00000000000000000000000000000000000000000000000000000000dc51da3a000000000000000000000000d8eeda4ee2657bb267bc35c1d60babdc5aedd269000000000000000000000000000000000000000000000000000000000000001cb4bf0dcd37ca73bd5abce9532b033dcc6427be160683de113efca41320c27f3e78799d84040e5c245828b1b531ef97e1af124946f4dc1db5a20cf28a7073b2690000000000000000000000000000000000000000000000275dcc081d0c2351e0

How can I convert inputs to readable string values?

PS: by readable string values I mean converted values from BN and Buffer types to utf8 strings.

All topic

How many independent control inputs does a hexarotor have?

  1. 6, because a rigid body has six degrees of freedom
  2. 4, since it is similar to a quadrotor, except with more motors
  3. 6, because there are six motors

I was taking an online quiz, and I thought option 3 is the correct one, only to find out I got the answer wrong. I know that I could change the answer 2 times and by chance I finally got it right, but I want to understand why option 3 is wrong?

All topic

How to share a single monitor to show the display inputs from 2(laptop/desktop) computers at the same time? [on hold]

I have a DELL PR026 docking station with which i’m trying to connect a laptop and a desktop CPU. I want to use a monitor which came along with the desktop system to display the desktop CPU’s digital output as well as the laptop’s(extended mode) at the same time. Also, I would like to share my mouse/keyboard the same way to operate on both my laptop as well as the desktop monitor(system). Any help is appreciated. THanks!

All topic

Making a circuit that takes 3 inputs and outputs 3 inversions of each input using only OR and And gate (2 NOT gates allowed)

How do you make a circuit that takes 3 inputs and outputs 3 inversions of those inputs using only 2x NOT gates and ∞AND and ∞OR gates.

No other kinds of gates are allowed.

As many AND and OR gates can be used, but only 2 NOT gates are allowed.

Please look at the diagram for better understanding.

All topic

Como contar a quantidade de elementos inputs dentro de uma div

Usando o Asp.net MVC, estou criando um os inputs dinamicamente usando um loop com os dados di banco.

@if (Model.PessoasContatosViewModel != null) { @for (int i = 0; i < Model.PessoasContatosViewModel.Count; i++) {
@Html.HiddenFor(model => model.PessoasContatosViewModel[i].Id, new { @class = "hid-id" })
} }

Usando o JavaScript, quando clico no botão Adicionar contato, preciso saber quantos inputs tenho dentro da minha div-contatos. Para isso, estou usando o JS:

var itemIndex = $("#div-contatos input.iHidden").length;

O Problema é que não está funcionando. O Retorno está sendo 0. O que está errado?

All topic

Why does Keras’ Model() have an inputs parameter?

In every single example of Keras’ Functional API documentation, when building a model with Model(), the inputs parameter seems redundant: it can be deduced from the steps that lead to the construction of the outputs. Why does this inputs parameter seem necessary, then?

One guess is that otherwise there can be questions about the order in which the inputs should be taken (especially when looking at multiple outputs). The (order of the) inputs could however be defined through some convention, but describing this convention would be more cumbersome than asking the user to manually re-inject the inputs of the outputs?

That’s only a guess: maybe there are some more fundamental reasons to ask the user to include redundant information even in cases like all those of the Functional API documentation?

All topic

Overlapping intervals of inputs at inputevents_mv table for same icustay_id and itemid

In the following example after I discarded from rows that were “Rewritten” I still have rows (for the same drug at the same ICU admission) that their time period is overlapping. so, I want to know if the patient received several different rates of the same drug at the same time or it is an error at the data?

(to be more specific, does he received at 16:15-17:49 -> 60 ml (49+10) or just 10 ml?)

SELECT icustay_id,itemid,starttime, endtime,amount,rate,ordercategorydescription,statusdescription FROM inputevents_mv
where icustay_id=200001 and itemid=220949 and statusdescription <> ‘Rewritten’
ORDER BY starttime

Thanksenter image description here

All topic

Getting multiple inputs in C++ simultaneously using kbhit() function

I am using Turbo C++ to make a game using the graphics.h library (I know it’s a bit old). In this game, the player can move left, right and they can jump using A, D and W (just like in Super Mario).

I am using the kbhit() function to get inputs from user. The problem with it is that I cannot jump and move the character at the same time (so it moves in a parabolic trajectory).
How can I take multiple inputs so that, for example, if I press W and D, character will jump towards right?

The code is given below:

if(kbhit())
{
    ch=getch();

    if(ch=='e'){break;}   //exit

    if(ch=='d')           //move right
    {
    ax=1;
    if(vx-vellim){vx=vx+ax*dt;}
    dx=vx*dt;
    x+=dx;
    s_mario(x,y);
    }

    if(ch=='w'&&jumpkey==0)   //jump
    {
    vy=60;
    jumpkey=1;
    }

}

if(jumpkey==1)
{
vy=vy-g;
dy=vy*dt;
y-=dy*0.1;
if(y>400){y=399;vy=0;jumpkey=0;}
s_mario(x,y);

}

if(!kbhit())
{       vx*=c;
    dx=vx*dt;
    x+=dx;
    s_mario(x,y);
    delay(5);
}

All topic