Categories
Mastering Development

How to implement an algorithm that creates a list of of tuples that hold specific values from a nested dictionary

Hello, I’m trying to implement the Nondeterministic finite automaton algorithm. Given a dictionary, start state, and list of inputs, I input the first input value into the start state. According to the dictionary ‘ndfa’ I receive a set of new states (ndfa[state][_input] -> {n_states}). I then move onto the next input value from the inputs […]

Categories
Mastering Development

R sf aggregate (unite) polygons at various geographic levels (columns) within a dataframe

I’m trying to aggregate polygons at different geographic levels. As a hypothetical and reproducible example, let’s suppose that I want to aggregate US county data set at the state level (of course, I can directly retrieve state-level polygons if this was my “actual” problem). I’ve tried to do it by applying st_union for each group, […]

Categories
Mastering Development

How to extract input from tkinter entry widget? (Python tkinter)

In Insert() function, I cannot extract data from entry widgets(I have used .get in database() function to extract data and the data is than stored in table and later it can be printed by Print() function). I have also used .set for drop down menu wh This is what I enter This is my output […]

Categories
Mastering Development

Why is my interface not being accepted at Entity?

I am creating a state for a cart and in each action I inserted a different interface. However when inserting the ICartState interface in EntityAdapter<> and createEntityAdapter<>, I get an error in each payload on the reducer saying that the given interface does not have the given interface. Like for example: Argument of type ‘ICartRequest’ […]

Categories
Artificial Intelligence (AI) Mastering Development

How can I make my deep Q learning agent more robust?

I am learning deep Q learning. I created the code below, where the standard and the target Q functions use the same network and there’s no replay memory. import gym import numpy as np import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import torch as T class LinearDeepQNetwork(nn.Module): def __init__(self, lr, […]

Categories
Mastering Development

Cannot create valid state with payload for reducer from ngrx documentation

I have problem to update state in ngrx reducer for action loadSuccess State after load action { dashboard: { serverList: null, isLoading: true, error: ‘zero’ } } State after loadSuccess action { dashboard: { isLoading: false, error: ‘zero’ } } const t1 = (state, action) => { return ({…state, serverList: action.payload.servers}); }; const reducer = […]

Categories
Artificial Intelligence (AI) Mastering Development

Ive created a deep q network. My model does not get better, and cant see what im doing wrong. Im new to RL

Replay Memory class ReplayMemory(object): def __init__(self, input_shape, mem_size=100000): self.states = np.zeros((mem_size, input_shape)) self.actions = np.zeros(mem_size, dtype=np.int32) self.next_states = np.zeros((mem_size, input_shape)) self.rewards = np.zeros(mem_size) self.terminals = np.zeros(mem_size) self.mem_size = mem_size self.mem_count = 0 def push(self, state, action, next_state, reward, terminal): idx = self.mem_count % self.mem_size self.states[idx] = state self.actions[idx] = action self.next_states[idx] = next_state self.rewards[idx] = […]

Categories
Mastering Development

Powershell Get difference in values between dates

I’m trying chart some data from a csv. The csv is structured like date,state,temp. What I’m trying to do is get the difference in the temp between the day prior and today. So the dataset in the original csv might look like this: 20200323,AK,34 20200322,AK,35 20200321,AK,42 Once I import the csv I’m creating a customobject […]

Categories
Mastering Development

Where do I handle form validation errors returned by the server in my React app?

I’m using React 16.12.0. I’m trying to figure out how to handle and display validation errors that are returned from my server. I have this form set up … import React, {Component} from ‘react’; import {FormControl, FormGroup} from ‘react-bootstrap’; /* Import Components */ import Input from ‘../components/Input’; import Country from ‘../components/Country’; import Province from ‘../components/Province’; […]

Categories
Database Development

How do I manipulate date in SQL server?

SELECT [ORG_ID], [BUSINESS_UNIT_NAME], [MESSAGE_ID], [MESSAGE_NAME], [DEPLOYMENT_ID], [DEPLOYMENT_NAME], [SMS_ID], [SMS_NUMBER], [ACTION_TIMESTAMP], [CUSTOMER_KEY], [CARRIER], [LINK_NAME], [LINK_URL], [SERVICE_ID], [ACTION], [EVENT_TYPE], [CLIENT_ID], [CAMPAIGN_ID], [CAMPAIGN_NUMBER], [CONTACT_ID], [EMAIL_ADDRESS], [ISO_CODE], [POSTAL_CODE], [STATE], [ADD_DATE], [SOURCE], [UPDATE_DATE], [UPDATE_SOURCE], ‘CONTACT_ID DOES NOT EXISTS IN THE DATABASE’ as REASON FROM [dbo].[SMS_ACTY] WHERE CONTACT_ID NOT IN (SELECT CONTACT_ID FROM CONTACT) and cast(add_date as date) = CAST(@run_id AS […]