machine learning – Can we supervise on the hidden states of RNN?

I’m trying to generate some history-dependent model with machine learning, whose underline physical model has a clear definition of its “internal state variable” (a state derived from historical inputs) and how this variable interacts with the inputs to get the outputs. Mathematically this reads: $y_t=f(x_t,h_t)$, $h_t=g(x_1, …, x_{t-1})$ .

Intuitively, this can be realized by RNN(or LSTM/GRU). Now I wonder if we can add the supervision on state variables to the loss function to improve prediction. For instance, we extract the hidden states $H$ output from our RNN and pass them through another branch of feed-forward network to predict the internal state variables $h$. The loss function then has two parts, one is for model outputs $sum (y-hat{y})^2$, and the other is for model internal states $sum(h-hat{h})^2$.

Any insight toward the following questions are welcomed:

  • Will this approach work? (Does it make sense?)
  • Potential issues?

I’ll also be really grateful if anybody can indicate closely related works in the answers! Thanks in advance!

schengen – border controls for Andorra and other micro states?

Andorra does perform border control to apply rules depending on the nationality of visitors. They have freedom of movement agreements in place but the border controls serves check which rules apply to visitors and also to impose limits in importation of industrial and agricultural products.

Customs control on the border

As well as checks on visas or passports for Andorra, customs checks
are carried out on the border, as there are limits to the amount of
agricultural and industrial products you can take across the border.
For more information about these limits, visit the Andorra border and
customs website, where you’ll also find their addresses and opening


PS: I actually have waited at both entry and exit borders a couple of years ago while driving in and out. If you made it through group transport, perhaps they arranged clearance another way but driving, they do ask for ID when arriving and exiting.

Can I travel domestically within the United States with my USA expired passport?

The TSA explicitly allows people to travel without ID. The following is taken from

In the event you arrive at the airport without valid identification, because it is lost or at home, you may still be allowed to fly. The TSA officer may ask you to complete a form to include your name and current address, and may ask additional questions to confirm your identity. If your identity is confirmed, you will be allowed to enter the screening checkpoint. You may be subject to additional screening.

You will not be allowed to fly if your identity cannot be confirmed, you chose to not provide proper identification or you decline to cooperate with the identity verification process.

TSA recommends you to arrive at least two hours in advance of your flight time to allow ample time for security screening and boarding the aircraft.

As I noted in a comment, I once traveled with someone who did this. She is a US resident (non-immigrant) with no official ID issued by any US entity, and she forgot her passport at home. They checked some of her credit/bank cards (and maybe her work ID, if I recall correctly), and let her fly. I think it took about 10 minutes, maybe 15, to get past the ID check. On the way home, it only took a minute or so extra.

I would therefore recommend that you bring everything you can that has your name on it, including your expired passport. They may reject it because it is expired; the page quoted above does say that the ID must be “valid.” The expired passport may nonetheless lend weight to your claim, and it certainly won’t hurt it.

Also bring bank cards, library cards, employee ID, social security card, birth certificate, school records, anything you can readily get your hand on. The worst possible outcome would be to leave something at home only to be told that you would have been allowed to board if you had brought it.

When you approach the ID officer, hand your boarding pass and say something like “I’m afraid I don’t have any valid ID, but I do have this expired passport and these other documents.”

If you are sensitive about being scolded, and worried what they might say, you can bring a printed copy of the TSA page that explains that ID isn’t strictly necessary.

json – Como atualizar um objeto dentro de um array usando states do React

Olá! O que estou tentando fazer é basicamente atualizar o estado de um objeto que está dentro de um array. Bem, esse é meu state original:


Então, a ideia é que eu atualize o “dataToUpdate” para true.

this.setState(prevState => ({
        liveData: {
          ( true,

Esse código acima foi o que eu fiz, mas não consegui entender o motivo pelo qual não está funcionando.

usa – What are the current travel restrictions on individuals entering the United States from regions affected by Covid-19?

This answer currently lists nationwide entry restrictions imposed by the United States federal (national) government in response to COVID-19. Some states as well as counties, municipalities, towns, and cities have imposed entry bans or automatic quarantine-upon-entry orders as well as stay-at-home orders that may prevent your intended travel. This answer cannot index all of these orders, which have slight differences, technicalities, and effective dates that must be consulted to determine if your planned travel activity is allowed under state and local law.

Travelers who do not already have a valid visa and will need one for their planned travel should note that the US Embassies and Consulates are beginning to re-open at this time for limited services. Check the website of the consulate in your country for more information. Be aware that their home countries consulates in the US may not be operating normally.

Entry bans for foreigners who have been in certain countries

Individuals who have been physically present anywhere in Mainland China (excluding Hong Kong and Macau), Iran, the Schengen Area1, the UK1 (excluding territories outside Europe), Ireland1, Brazil, South Africa2, or India within the past 14 days cannot travel to the US at all unless they meet one of these exceptions:

  • US citizens and nationals
  • US lawful permanent residents (green card holders)
  • spouses of US citizens or LPRs
  • parents of unmarried US citizens/LPRs under 21
  • siblings of US citizens/LPRs, both unmarried and under 21
  • children, foster children, and adoptees of US citizens/LPRs
  • air and sea crew members
  • diplomats and foreign officials
  • those granted exceptions by officials
  • immigrant visa holders, fiance visa holders, and certain exchange visitors3
  • F-1 and M-1 students in a program commencing August 1, 2021 or later4

Text of the presidential proclamations and effective dates:

  • For Mainland China: Proclamation 9984, effective February 2, 2020 at 5:00pm EST
  • For Iran: Proclamation 9992, effective March 2, 2020 at 5:00pm EST
  • For the Schengen Area: Proclamation 9993, effective March 13, 2020 at 11:59pm EDT
  • For the UK and Ireland: Proclamation 9996, effective March 16, 2020 at 11:59pm EDT
  • For Brazil: Proclamation 10041 (as amended by Proclamation 10042), effective May 26, 2020 at 11:59pm EDT
  • For South Africa: Proclamation 10143, effective January 30, 2021 at 12:01am EST
  • For India: Proclamation 10199, effective May 4, 2021 at 12:01am EDT

(1 As of July 16, 2020, the Department of State announced that students with F-1 and M-1 visas who will travel from the UK, Ireland, or the Schengen Area are automatically allowed to travel. J-1 students and others, such as E visa treaty traders/investors, academics, and certain other business travels, who will travel from those countries, may be able to obtain a National Interest Exception and should contact their nearest consulate or embassy to do so.

2 As of January 28, 2021, the Department of State announced that H-2 workers who will travel from South Africa may be able to obtain a National Interest Exception and will be considered for the exception when applying for the visa. Those who already have visas should contact the consulate or embassy that processed their visa.

3 As of April 8, 2021, the Department of State announced that immigrants, fiance visa holders, and certain exchange visitors who are subject to the geographic entry bans have a National Interest Exception and will be able to obtain a visa when visa services otherwise resume at the local US consulate. This also applies to the subsequent India ban.

4 As of April 26, 2021, the Department of State announced that F-1 or M-1 students from all countries, in programs beginning August 1, 2021 or later qualify for a national interest exception. If they already have valid visas, they may travel to the US no more than 30 days before the beginning of their program, without needing to contact a US consulate. Those applying for an F-1 or M-1 for a program beginning August 1, 2021 or later will automatically be considered for an exception. This also applies to the subsequent India ban.)

Upon arrival, such excepted passengers may be subject to public health screenings upon arrival. The US Centers for Disease Control have asked all international arrivals to self-quarantine for 14 days. This is not legally binding, however, it is possible that federal, state/territory, or local health officers could impose mandatory quarantine orders on specific passengers.

The Department of Homeland Security has a page on air travel restrictions, a fact sheet, and a list of news and updates. The CDC has a page on procedures for travelers from the affected countries.

This action does not affect aliens (immigrants or nonimmigrants) already in the US. It does not cancel or revoke valid visas, though it temporarily prevents their use and may prevent the issuance of new visas in some cases.

The restrictions will remain in effect until further notice from the government. The Secretary of Health and Human Services is to advise the President at least every 15 days whether or not the ban should be changed or cancelled.

COVID-19 test requirement

All travelers to the US by air, including US citizens, who are 2 years of age or older, must have a negative COVID-19 test within 72 hours of their flight in order to board the airplane. This does not apply to entry to the US by land. See frequently asked questions.

Land border entry restrictions

Entering the US through land borders from Canada or Mexico is limited to “essential travel”:

  • US citizens and permanent residents returning to the US
  • Travel for medical purposes
  • Travel to attend educational institutions
  • Travel to work in the US
  • Travel for emergency response and public health purposes
  • Lawful cross-border trade
  • Official government or diplomatic travel
  • US armed forces and their family returning to the US
  • Military-related travel

These rules cover anyone traveling across the land border, even if they are not Canadian/Mexican. They do not affect entry from Canada or Mexico by air, although there have been reports of CBP officers applying extra scrutiny to such travelers.

Effective date: March 20, 2020 at 11:59pm EDTJune 21, 2021 at 11:59pm EDT (may be extended on a monthly basis as needed)

Text of the regulations:

  • For US-Canada land border: this document, as extended by this document, this document, this document, this document, this document, this document, this document, this document, this document (as corrected), this document, this document, this document, this document, and this document
  • For US-Mexico land border: this document, as extended by this document, this document, this document, this document, this document, this document, this document, this document, this document (as corrected), this document, this document, this document, this document, and this document

DHS has announcements for the US-Canada and US-Mexico land border restrictions.

Immigrant visa and work visa bans (no longer in effect)

Foreigners could not enter the US as immigrants, or as non-immigrants on H-1b, H-2b, J-1, or L-1 status or their dependents, unless they met one of these exceptions:

  • people who were inside the US on the effective date of the ban
  • people who had a visa of the same type on which they are seeking entry, that was valid on the effective date of the ban
  • people who had a travel document other than a visa that permits them to travel to the US (e.g. an Advance Parole), that was valid on the effective date of the ban or issued thereafter
  • US lawful permanent residents (green card holders)
  • people entering the US as medical professionals or to conduct research on COVID-19
  • immigrants entering on the EB-5 investment immigration category
  • spouses of US citizens
  • unmarried under-21 children and adoptees of US citizens
  • people whose entry furthers law enforcement objectives
  • members of the US armed forces and their spouses and children
  • immigrants in the SI and SQ special immigrant categories
  • people whose entry would be in the national interest

Text of the presidential proclamations and effective dates:

The Department of State has detailed the national interest exceptions for these two bans.

Entry airport restrictions (no longer in effect)

From the effective date of the entry ban for a given country until September 14, 2020, all flights carrying at least one non-crew passenger that had been physically present in Mainland China, Iran, the Schengen Area, the UK, aireland, or Brazil within the past 14 days but who were exempt from the entry ban, were required to land at one of the following airports: JFK, ORD, SFO, SEA, HNL, LAX, ATL, IAD, EWR, DFW, DTW, BOS, MIA, FLL, or IAH.

Questions and Answers

I heard about some changes to student visa rules. Where are those? You likely heard about a rule change to the Student Exchange Visitor Program that would have forced international students on F-1/M-1/J-1 visas to leave the country if did not have at least one in-person class, even if their entire school had moved online. The US Government abandoned this rule when it was challenged it court. This rule is no longer in effect and no changes to your I-20 or student visa should be required for you to enter the country. If you are a new student and do not have an F-1 visa, be sure to closely follow the website of the embassy in your country–each consular post is announcing their own plans for resumption of visa services.

What if I do not comply with these rules? If you lie to officials to avoid the regulations, you could face serious immigration consequences including expedited removal from the country and a permanent inadmissibility in the future.

memory hardware – Computing with Extra States

So, computing largely operates through states of 0 or 1, this I am aware of. But I do have a question, is there a meaningful difference in computing using more states. For example, 0, 1, and 2. Logically, looking at the surface, this would allow encoding more information in a smaller number of bits. But is this actually how it would work in theory?

New question looking at answers given, how exactly would a Base-e system work? or does this only work in Pure Mathematics and not the physical world?

Which vaccines when traveling to the United States?

Does each state have different vaccines?
Which vaccines are important take when traveling to the United States?

finite automata – Proof that for every $k > 1$, there exists a language $A_k subseteq {0, 1}^*$ s.t. a DFA accepting $A_k$ has $k$ states but no less

I am trying to prove that for every $k > 1$, there exists a language $A_k subseteq {0, 1}^*$ such that a DFA accepting $A_k$ has $k$ states but no less.

I thought about proving this in two ways: constructively, or by contradiction.

By Contradiction: For some $k > 1$, suppose there is no language $A_k subseteq {0, 1}^*$ where a DFA accepting $A_k$ exists with exactly $k$ states but no less. Then any language $L subseteq {0, 1}^*$, that has an accepting DFA with $n$ states, also has an accepting DFA with $n – 1$ states. Extending this reasoning downward, this implies that every $L$ has an accepting DFA with $1$ state. This is a contradiction.

By construction: Let $A_k = {w in {0, 1}^* | w text{ has } 0^{k – 1} text{ as a substring}}$. But now I need to prove that $A_k$ cannot be accepted by a DFA with less than $k$ states. I am unsure of how to do this even though it feels true intuitively.

Is my proof by contradiction valid and is the proof by construction doable? Maybe both are wrong and I need to use some other perspective.

regular languages – NP completeness of deciding whether a set of examples, consisting of strings and states, has a corresponding DFA?

I’m working on a textbook problem, 7.36 in Sipser 3rd edition. It claims that if we are given an integer $N$ and set of pairs $(s_i, q_i)$, where $s_i$ are strings and $q_i$ are states (we are unconcerned here with whether the states are accepting), then the problem of “deciding whether there exists some $N$-state DFA for which each $s_i$ causes that DFA to end up in state $q_i$” is NP-complete.

A much more well-known result by Gold (1978) is the same as the above, except with the examples being in the form $(s_i, mathrm{accept})$ and $(s_j, mathrm{reject})$ instead of having the state $q_i$. That result is discussed in some other threads, like this, this, and this.

If I naively try to reduce from the Gold problem to the Sipser problem, I would try to replace all “accept” with a single “terminal” accept state, and same for reject, but that fails because you can only have a single terminal accept state in an NFA; if you try to convert that back to DFA, the single terminal states may split up into multiple, which would invalidate your examples.

I suspect Myhill-Nerode may be useful here, since the DFA states correspond to the equivalence classes of strings. I think you can rephrase the Sipser result as deciding whether some given set of strings can be partitioned into some given set of Myhill-Nerode equivalence classes.

I searched through the literature, but was not able to find the Sipser result anywhere. What is another decision problem that we can use as a polynomial-time reduction here? Alternatively, is this result derived or discussed anywhere else?

swift – Accessing State’s value outside of being installed on a View. This will result in a constant Binding of the initial value and will not update

I tried to encapsulate the gesture in a class and then call it in another view.
My project can run well, and it can be built well. but Xcode12 give me a pink error. This is my code

class GestureClass: ObservableObject {
    private var minZoom:CGFloat=1
    private var maxZoom:CGFloat=4.00
    @GestureState private var magnificationLevel:CGFloat=1
    @Published public var zoomLevel:CGFloat=1
    @Published public var current:CGFloat=1
    var magnify: some Gesture {
        .updating($magnificationLevel, body:{(value,state,_) in
           return state=value
        .onChanged({ value in
            self.current = value
        .onEnded({ value in
            self.zoomLevel = self.setZoom(value)
            self.current = 1
    func setZoom(_ gesturevalue:CGFloat) -> CGFloat {
        return max(min(self.zoomLevel*gesturevalue, self.maxZoom), self.minZoom)
    func gestureresult() -> CGFloat {
        return self.setZoom(self.current)

struct GestureModelView: View {
    @EnvironmentObject var gesturemodel:GestureClass
    var body: some View {
        let myges = gesturemodel.magnify
        HStack {
                .frame(width:200*gesturemodel.gestureresult(), height:200)