text:
# Tag Info

18

This is encoded in Unicode as "Combining Comma Above" (U+0313} and with a suitable font and XeLaTeX or LuaLaTeX can be entered directly. In the example below I've made a \glottal macro to make input simpler. I've used Doulos SIL as the font, which places the character correctly; other fonts may place it differently, unfortunately (for example, Linux ...

11

Presumably you do not get âAZ but âĂŹ \documentclass{article} \usepackage[T1]{fontenc} \begin{document} [’] \end{document} Produces To see why, see that ’ is U+2019 that is, the character with value hex 2019. In UTF-8 encoding, characters in that range take three bytes, in this case E2 80 99 Unless told to interpret such triples via the declaration \...

7

You can use a smaller apostrophe, that can be stacked on the letter with tabular. \documentclass{article} \makeatletter \DeclareRobustCommand\glottal[1]{% \check@mathfonts \begingroup \renewcommand{\arraystretch}{0}% \begin{tabular}[b]{@{}c@{}} \fontsize{\ssf@size}{0}\selectfont \raisebox{-0.7ex}[\dimexpr\height-0.7ex][0pt]{'}\\ #1 \end{...

6

Remove the activeacute option: if you use UTF-8 you don't need it. \begin{filecontents*}{\jobname.bib} @article{test1, title = "Designing conjoint choice experiments using managers' prior beliefs", author = "Zsolt Sándor and Michel Wedel", year = "2001", journal = "Journal of Marketing Research", volume = "38", number = "4", pages = "430--444" } @...

5

Add \usepackage[utf8]{inputenc} to fix the issue.

5

You could use stackinset from stackengine package: \documentclass{article} \usepackage{stackengine} \newcommand{\glottal}[1]{\stackinset{c}{}{t}{-3.2pt}{,}{#1}} \usepackage{newtxtext}% copied from Mico's answer \begin{document} Some\glottal{t}hing Something \glottal{t} something \end{document}

5

You have in mind $$G^{\prime} = (V^{\prime}, E^{\prime})$$ or, much easier, $$G'=(V',E')$$

4

A simpler solution for \texttt: \documentclass{article} \usepackage[T1]{fontenc} \usepackage{textcomp} \usepackage{xparse} \ExplSyntaxOn \RenewDocumentCommand{\texttt}{m} { \tl_set:Nn \l_nemgathos_upquotes_tl { #1 } \tl_replace_all:Nnn \l_nemgathos_upquotes_tl { '' } { \textquotedbl } \tl_replace_all:Nnn \l_nemgathos_upquotes_tl {  } { \...

4

Here's a solution that uses the \ooalign "primitive" to place a script-sized apostrophe above the macro's argument (here: t). The code assumes that the \glottal macro will never be used in first-level, let alone second-level subscript and superscript material. I trust this isn't much of a constraint. \documentclass{article} \newcommand\glottal[1]{% {\...

3

It often happens that copying code from a PDF file leads to incorrect TeX markup. For instance, if I copy the code on page 40 of the manual for tkz-euclide (version 1.16c) and paste it here, I get \begin{tikzpicture}[scale=2] \tkzDefPoint(0,0){O} \tkzDefPoint(2,-1){A} \tkzDefPoint(2,2){B} \tkzDefPointsBy[symmetry=center O](B,A){} \tkzDrawLine(A,A’...

3

You need to set the mono font, otherwise you get the default Latin Modern without “TeX ligatures”. However, usually ligatures (and curly quotes) are not wanted in typewriter type. \documentclass{report} \usepackage{fontspec, fancyvrb} \setmainfont{CMU Serif} \setmonofont{CMU Typewriter Text}[Ligatures=TeX] \DefineVerbatimEnvironment{VRB}{Verbatim}{...

3

You say that you don't see why you shouldn't use U+0027 for apostrophe and U+2019 for right single quotation mark. You could do this by using the csquotes package and making ' a babel shorthand for british and defining it as a straight quote. Note that this will use a straight apostrophe everywhere when the current language is british, not just within ...

3

You can substituate glyphs conditionally. The main problem is to find out the correct name. In EBGaramond I found e.g. a variant called sinf: \documentclass[12pt]{article} \usepackage{fontspec} \directlua{ fonts.handlers.otf.addfeature{ name = "apo-sc", type = "chainsubstitution", lookups = { { type = "substitution", ...

2

I don't have the font to actually check this approach, so what I did as a surrogate is to print apostrophes in bold red those which should be output as \textup{'}, and those in black will be output as \scshape'. I use listofitems to redefine \textsc. Here I search for all combinations of capital letters followed by an apostrope. While all the rest of the ...

2

Various things like managers{'} prior did not work, but managers'\ prior did work. \documentclass[letterpaper, 12pt, oneside]{book} \usepackage[activeacute,spanish]{babel} \usepackage[utf8]{inputenc} \usepackage[fixlanguage]{babelbib} \selectbiblanguage{spanish} \usepackage{filecontents} \begin{filecontents*}{bibliografia.bib} @article{sandor01_conjoint, ...

2

tex4ht uses special file, unicode.4hf, to translate certain characters in the converted document to some other characters, or XML entities. Otherwise, they are written as utf8 characters, when you use -utf8 option for tex4ht. This file is requested by -c option for tex4ht command, in your case it is unihtf. There are several version of unicode.4hf in the ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
“Active Low” SCR

Background: I'm working on a circuit that uses an ATmega 328 processor, and a hall effect sensor. We're creating a small wireless sensor, so what we're focusing on now is power consumption. We want to seal a battery within the unit, but that means that our battery life starts as soon as the device is manufactured, rather than when a customer starts using it.

I've been thinking of a way to "turn on" the circuit when it's ready to be used. The obvious ways of "insert a battery" or "flip a switch" don't work as well, since the unit needs to be 100% sealed to protect against the environments it will be in.

My idea was to use the hall effect sensor to latch the processor's power on, so the first time it encounters a magnetic field, the circuit turns on. We're using an AH920 hall effect sensor, which provides a low signal when a magnetic field is present. From my research, all SCRs I found needed a high signal to latch on.

Question: Can you make an active low SCR? Since an SCR is just 2 transistors in a feedback loop, if you moved the Gate connection to the base of the PNP transistor (instead of NPN) would it still work the same?

The secondary question is, if I wanted to make an SCR with 2 transistors, instead of an IC, how can I tell how much current is consumed in the feedback loop that keeps both transistors on?

• Yes you can with NPN base shunt to reduce sensitivity to PNP leakage current. How about a touch sensor toggle power switch from idle or sleep mode – Sunnyskyguy EE75 Jul 16 '18 at 19:50
• A practical SCR using discrete transistors picked out at random will be a little more complicated, regardless of where you place the gate pin. – jonk Jul 16 '18 at 19:59
• Note that an MCU typically cannot control its own power via a single inverting-type active semiconductor. To make that work, you need a non-inverting structure of two; otherwise the I/O protection diodes end up completing the path to turn it on. – Chris Stratton Jul 16 '18 at 22:03

You are chasing your own tail trying to add components to reduce the power consumption of the ATMega328P, it already has incredibly low power consumption when in a deep sleep state.

You should read the information here, Nick catalogues the various states and gives you a small sketch to test out each one.

You can get the current down to about 0.15uA which is well less than the self discharge rate of most of the batteries you might potentially use:

The leakage current of a P-FET (perhaps this) is likely in the order 0.5 uA and the typical Hall-effect sensor you might use (perhaps this) in the order of 0.5 - 1.0 uA for a total of probably more than 1 - 1.5 uA leakage just for your sensor logic.

One potential workable solution would be to put you MCU to deep sleep, and wake on a pin change. You could use a small reed relay if you wanted magnetic trigger ...or you could use a real switch (N.O. or N.C.) to trigger.

• I might be able to do it with the hall effect connected to an interrupt pin. Deep sleep until signal seen. – Xyver Jul 20 '18 at 20:01
• @Xyver The problem is as soon as you put a Hall Effect sensor in place your current budget will increase above what the ATMega will draw. IMO the lowest possible current budget would be a small reed relay to trigger the AVR awake. If you really want to get close to the self discharge rate of the battery (which would be the longest battery performance possible) then I don't see another way to go. – Jack Creasey Jul 20 '18 at 20:15

You want to find a better solution than the "SCR". The voltage drop across it causes too much potential loss of battery capacity due to the reduced voltage available to the load. Instead you should be considering a P-FET switch gets dynamically gets turned on when energy from the battery is needed.

The control structure around the P-FET can be the microcontroller that goes into low power sleep mode except when processing is required. Wake from sleep can be periodic via a timer or event driven from some changing signal. There are numerous MCUs that have very low power consumption in sleep mode and the software would turn off the P-FET to shut off power to rest on the circuit while asleep.

• Yes, I noticed that as well (the SCR has a ~1V drop), so I was going to use the SCR to turn on a transistor, to activate the processor. Then there would only be a 0.2V drop (or less, one transistor I was looking at was 0.05V) We are using the sleep mode as well, thats one of the main power reducers in the circuit. – Xyver Jul 16 '18 at 20:22
• Since you are already using sleep mode drop the SCR completely and just use the P-FET controlled from the mcu output pin. No need for the continuous current sink of the SCR. Also use the FET instead of a BJT. Base current in BJT is also wasted battery energy. – Michael Karas Jul 16 '18 at 20:43
• I can imagine how to make it so that the PFET turns the rest of the circuit on and off when entering/exiting sleep mode, but how would I use it for the "first on" activation of the circuit? We're aiming for at least a year of battery life, and the way we have the sleep/awake cycles, the sleep portion still eats about 50% of power. So if the circuit was always asleep, it would still only last 1.5 years... – Xyver Jul 16 '18 at 21:22
• @Xyver If you are looking for a year's operation and are already at 50% just sleeping, you need to take a close look at other MCU families which are FAR FAR superior in this regard. Have you already done so and rejected them for some reason? – jonk Jul 17 '18 at 4:44
• @jonk I just started this project, my coworker designed the rest of the circuit. I'm pretty sure the atmega was chosen since its the same processor on arduinos, the other one I was researching and going to suggest was the Attiny. I need to look at the code to see if we can port it over. The calculations we've done are based on the microcontroller sleeping for 8 seconds, waking up to increment the watchdog, then sleeping again. This continues, and every 15 minutes the microcontroller reads the sensors, sends a signal to the base station, and goes back to sleep. – Xyver Jul 17 '18 at 17:43

I don't know if size is a concern, but if not too much, then you could incorporate a normally closed reed relais and store the circuit together with a magnet glued to it, to be removed when use starts.

• What you are referring to is a reed switch. A reed relay would be that plus a coil, which is both unnecessary and unworkable here, since the coil would draw more power than permissible. – Chris Stratton Jul 16 '18 at 22:00
• Yes, you're right, a reed switch. Then add a magnet, as I mentioned before, and let the buyer remove the magnet upon first use. – HarryH Jul 18 '18 at 8:15

format: plain


text: Characterize the set $\{f\in\mathsf{FCD} \mid (\mathsf{RLD})_{\mathrm{in}} f=(\mathsf{RLD})_{\mathrm{out}} f\}$. (This seems a difficult problem.)


text: 1. According to literal data by Xinchao et al. Lime can not only adjust the PH value, but also play a role in flocculation and phosphorus removal. Such as ferrous sulfate + lime for dyeing wastewater treatment or decolorization. The ferric ion (like the aluminium ion) hydrolyses to form hydrates and an acid. High pH (pH >8) favored the forma- tion of some colloidal cadmium sul- fide precipitate. Other iron compounds may be more water soluble than the examples mentioned above. The pH required to precipitate most metals from water ranges from pH 6 to 9 (except ferric iron which precipitates at about pH 3.5). The ferric ions can react with various organic pollutants and dissolved phosphates in the wastewater to form alum precipitates, and destroy the chromogenic groups in the wastewater to achieve the effect of flocculation and decolorization. The pH required to precipitate most metals from water ranges from pH 6 to 9 (except ferric iron which precipitates at about pH 3.5). Usually groundwater has a low oxygen content, thus a low redox potential and low pH (5.5- … Ferrous sulfate has a strong reductive, but it needs in the alkaline environment to make full use of its oxidation and flocculation. The removal rate of this solution is up to 88%. The types and amounts of metals in the water therefore heavily influence the selection of an AMD treatment system. The form of iron in water depends on the water pH and redox potential, as shown in the Pourbaix diagram of Iron below. Ferrous iron, the preferred iron form and is soluble in water at any pH. In the present work, the effect of temperature and solution pH on calcium carbonate precipitation from iron‐rich waters was investigated. A process has been developed that chemically removes total phosphorus from solution. The decolorization rate of this solution can reach 92%. 3. present as part of the dissolved iron in natural water at alkaline pH, and Fe (OH)2 (aq) may exist at pH 10 and above. The formation of bacterially oxidized iron precipi- tates was carried out in 100-ml volumes of solution containing 0.1 to 0.2 MFe2+,adjusted to pH2.5 with H2SO4,anddispensedin cotton-plugged 250-ml Erlen- meyerflasks. These insoluble precipitation are as follows . Eachflask received approximately1011 cells of T. ferrooxidans suspended in H2SO4, pH2.5. Ferric iron, however, is only soluble below a pH of around 5.5; but if the pH is higher than 5.5, which more than likely it will be in a planted aquarium, the ferric iron will become insoluble and precipitate, settling in the root zone. If the pH of the water is lower than 6.8, the greensand probably will not filter out the iron and manganese adequately. The settling characteristcs of pre- cipitates could be significantly im- proved with the addition of anionic polymer at a lower pH or the use of freshly prepared calcium sulfide slurry. Although Fe 2+ is very soluble, Fe 3+ will not dissolve appreciably. In other words, AlCl 3 will be soluble only in fairly acidic solutions. Ferrous sulphate has ability of neutralization and destabilization for suspension of colloidal granular in waste water. When the solution PH > 9, ferrous sulfate can be used as a bleaching agent. The water solubility of some iron compounds increases at lower pH values. Under these high pH conditions, the oxidation of ferrous iron is very rapid and this leads to the … Ferrous hydroxide will precipitate in the 7-9 pH range[1] . When the PH value reaches 8 or more, after hydrolyzed, ferrous sulphate is oxidized to form a multinuclear complex, making the dyestuffs of the colored suspended matter in the waste water are flocculation into the precipitate when it through the net. Aerated water with a pH between 7 and 8.5 contains mostly insoluble ferric iron. So, to put it in a nutshell, ferric iron will precipitate; ferrous iron will not. The increase in the temperature or the solution pH leads to the acceleration of … Iron carbonate has a water solubility of 60 mg/L, iron sulphide of 6 mg/L, and iron vitriol even of 295 g/L. Therefore, we often add with the alkali water treatment agent to keep the water in alkaline PH. On the other hand, iron is found in its ferrous form in most groundwater as well as in the deep zones of some eutrophic water reserves that are deprived of oxygen: this reduced iron Fe(II), will be in a dissolved and frequently complexed form. 9.4.3 Iron salts Ferric ions can be hydrolysed and precipitated as ferric hydroxide at pH >4.5. Iron, for example, can occur in two forms: as Fe 2+ and as Fe 3+. increases to about 2.2 , the Fe present in the ferric form begins to precipitate and when the pH increases to 3.2 all of the dissolved ferrice iron will precipitate as gelatinous ferric hydroxide [ Fe(OH) 3] . Preparation and reactions. When the solution pH> 7, the flocculation effect is obvious. Second, the primary particles formed then flocculate. The observed pattern of change in solution pH and the variation in the rates of orthophosphate and iron removal together with the data collec- ted on precipitate characteristics (see discussion on precipitate charac- teristics) suggest that in the vicinity of pH 8. The concentration of anions in solution can often be controlled by adjusting the pH, thereby allowing the selective precipitation of cations. Iron bacteria growth is very dependent upon the pH level, occurring over a range of 5.5 to 8.2 with 6.5 being the optimum level. Suppose, for example, we have a solution that contains 1.0 mM Zn 2 + and 1.0 mM Cd 2 + and want to separate the two metals by selective precipitation as the insoluble sulfide salts, ZnS and CdS. Frequently, bacteria are … Precipitation Region - The region on a solubility diagram that indicates the appropriate concentration and pH value for a metal to form a We again end up with the final pH being just acidic enough to dissolve $\pu{10 mg}$ of iron (iii) hydroxide in $\pu{100 ml}$ of water, but obviously the solution must start out more acidic. A pH value of 9 – 9.5 will usually precipitate both ions to their required level. Poor coagulation occurs in the pH range between 7 and 8.5. 5) Calculate the pH: pH = 14 - pOH = 14 - 10.574 = 3.426. The PH value need to use alkali agents (such as lime) to change into alkali. Ferrous sulfate or ferric sulfate buffered with TRIS hydroxymethyl amino methane at pH 7.3 to 7.6 can effectively reduce the concentration of phosphorus from 120ppb down to 6 or 7ppb. 0 the mechanism by which reactants are removed from solution and the composition of the products formed vary with time. But if the pH is higher than 3.5 the ferric iron will become insoluble and precipitate (form a solid) as an orange/yellow compound called yellowboy. What is the best precipitation PH of ferrous sulphate in water treatment? The pH MUST be maintained at 3.426 or lower in order to keep the AlCl 3 in solution. 2. acidity, i.e., its pH. At a pH of less than about 5, the oxidation rate is much slower than at a higher pH, so little ferric iron is formed. Aluminum hydroxide usually precipitates at pH > 5.0 but again dissolves at pH 9.0. First, the monomeric form of silica is quickly depleted from solution as it polymerizes to form primary particles ∼5 nm in diameter. In this particular example, Al(OH) 3 will precipitate if the pH is 3.426 or higher. Most greensand filters are rated to be effective treating water with iron concentrations up to 10 mg/l. Calcium carbonate was precipitated by CO 2 removal. In the presence of oxygen, iron ions are oxidized to ferric ions and iron (III) hydroxides form orange-yellow precipitate (called yellow boy) at pH > 3.5. Key Takeaway The anion in sparingly soluble salts is often the conjugate base of a weak acid that may become protonated in solution, so the solubility of simple oxides and sulfides, both strong bases, often depends on pH. The increase in the temperature or the solution pH leads to the acceleration of … When the COD is insoluble in water, it will go through electric and then flocculation, precipitate to form sludge together with the ferric hydroxide. At a pH at which the solubility of one metal hydroxide may be minimized, the solubility of another may be relatively high. The oxidation and subsequent precipitation is done at pH 8.5–9.5 (Cominco Engineering Services, 1997; Brown et al., 2002). Zinc pH 10.1; Metal hydroxides are amphoteric, i.e., they are increasingly soluble at both low and high pH, and the point of minimum solubility (optimum pH for precipitation) occurs at a different pH value for every metal. 5. The iron Fe2 + will oxidized to ferric iron Fe3 + after decomposed in water, and then occur the flocculation reaction. Precipitation - Precipitation is the process of producing solids within a solution. This study is the first to show that silica precipitation under very acidic conditions ([HCl] = 2−8 M) proceeds through two distinct steps. The final solution will again have a pH of $2.94$ or a $\ce{[H^+]} = 1.16\cdot10^{-3}$. Fe3 + 4Fe (oH) 2 + 2H2O + O2--4Fe (OH)3. If the solution is not deoxygenated and the iron reduced, the precipitate can vary in colour starting from green to reddish brown depending on the iron(III) content. The FeS is precipitated by reacting solutions of an iron salt such as ferric chloride (FeCl 3) or ferrous sulfate (FeSO 4) with sodium sulfide (Na 2 S) or sodium hydrogen sulfide (NaHS), with the addition of an alkaline such as sodium hydroxide (NaOH) to raise the pH above 7 to prevent evolution of hydrogen sulfide (H 2 S) gas. In the search for lower cost methods of recovering copper, the use of sponge iron or particulate iron (as distinguished from iron powder used in powder metallurgy) as precipitants in place of tin cans, detinned scrap iron, or scrap iron is an intriguing possibility. It should be noted that: In the process of flocculation, with the increasing amount of ferrous sulphate, the solution alkalinity reduces, the lower flocculation effect will occur. Iron(II) hydroxide is poorly soluble in water (1.43 × 10 −3 g/L), or 1.59 × 10 −5 mol/L. 4. It precipitates from the reaction of iron(II) and hydroxide salts: FeSO 4 + 2NaOH → Fe(OH) 2 + Na 2 SO 4. At a pH less of than about 3.5 ferric iron is soluble. US3150081A US216755A US21675562A US3150081A US 3150081 A US3150081 A US 3150081A US 216755 A US216755 A US 216755A US 21675562 A US21675562 A US 21675562A US 3150081 A US3150081 A US 3150081A Authority US United States Prior art keywords solution iron precipitation brought stirred Prior art date 1962-08-14 Legal status (The legal status is an assumption and is not a … … Views:1226     Author:VV     Publish Time: 2017-09-27      Origin:Rech Chemical Co. LTD. Ferrous sulfate can be used as a reducing agent, decolorant agent, and it has a very good effect in remove auxiliary chemical phosphorus in wastewater. When levels of dissolved oxygen in groundwater are greater than 1-2 mg/L, iron occurs as Fe 3+, while at lower dissolved oxygen levels, the iron occurs as Fe 2+. However, before the onset of ferric precipitation, the ferrous iron has to be oxidised to the ferric state, usually by bubbling air through the acid mine drainage solution. Calcium carbonate was precipitated by CO 2 removal. If this happens, the water analysis will show little iron in solution. This translates into phosphorus removal efficiencies of 95%. If the water is to be analyzed for iron, the sample must be acidified to a pH of 4 or less or the ferrous iron in solution will precipitate as ferric iron before it can reach the lab. In metals removal, it is desirable to precipitate as much metal solid as possible so that it can be removed from the water. This causes the familiar orange coatings on stream bottoms that tends to smother aquatic life. The total solubility of iron at pH levels from 4 to 9 is shown graphically by seven curves for Eh values from 0.10 to +0.50. The iron Fe2 + will oxidized to ferric iron Fe3 + after decomposed in water, and then occur the flocculation reaction. Above these values, dechelation will probably become significant, and any dechelated iron will precipitate in the presence of phosphate ions, becoming effectively unavailable to plants. And it reacted with water, created viscose of ferric hydroxide colloid which has a strong adsorption. The ferric ions can react with various organic pollutants and dissolved phosphates in the wastewater to form alum precipitates, and destroy the chromogenic groups in the wastewater to achieve the effect of flocculation and decolorization. In solutions that contain mixtures of dissolved metal ions, the pH can be used to control the anion concentration needed to selectively precipitate the desired cation. If chromium must be precipitated to a level less than 0.5 mg/l the pH must be operated at 7.0-8.0. If nickel is present it must be precipitated with sulfide as the metallic sulfide ion. (2005), hydroxides of ferrous ions precipitate at pH > 8.5. The standard dogma for chelation of iron is that EDTA is useful up to pH 6.5 and DTPA is useful to pH 7. In the present work, the effect of temperature and solution pH on calcium carbonate precipitation from iron‐rich waters was investigated. In the PH range of 7-8, ferrous sulfate can be used to remove COD. Many iron … Ferric iron is insoluble in water that is alkaline or weakly acidic. , Jar Test Procedure for Precipitants, Coagulants, & Flocculants, Lab Bench – Scale Jar Testing for Coagulants & Flocculants, Comparing Common Metal Precipitating Agents (AWT: the Analyst Winter 2017). Ferrous iron converts to a … Iron is usually found in its ferric and precipitated form in surface water, often in combination with suspended solids; it will then be eliminated during the clarification stage. The amounts of iron that theoretically could be present in solution are The pH can be raised above 7.0 by running the water through calcite pretreatment. Fe3 + 4Fe (oH) 2 + 2H2O + O2--4Fe (OH)3. 3.5 ferric iron will precipitate ; ferrous iron will precipitate in the work. Dtpa is useful to pH 6.5 and DTPA is useful up to 88 % rated... In alkaline pH in solution hydroxide colloid which has a strong reductive, but also play role! And amounts of metals in the 7-9 pH range of 7-8, ferrous can! Alkali agents ( such as ferrous sulfate has a strong adsorption iron is insoluble in water treatment agent to the! Carbonate has a strong reductive, but also play a role in flocculation and phosphorus removal the standard for. 7.0 by running the water treating water with a pH at which solubility! 3 will be soluble only in fairly acidic solutions, for example, Al OH! The process of producing solids within a solution chromium must be precipitated sulfide. Is desirable to precipitate as much metal solid as possible so that it can be used to COD... Soluble than the examples mentioned above precipitation from iron‐rich waters was investigated to a level than. Ferric hydroxide at pH > 8 ) favored the forma- tion of some colloidal sul-. 2H2O + O2 -- 4Fe ( OH ) 3 approximately1011 cells of ferrooxidans... Ion ) hydrolyses to form hydrates and an acid II ) hydroxide is poorly soluble in water treatment pH and! Sul- fide precipitate iron is soluble eachflask received approximately1011 cells of T. ferrooxidans in! H2So4, pH2.5 ferric ions can be removed from the water through pretreatment... Used as a bleaching agent to 10 mg/l pH of ferrous ions precipitate at pH 8.5–9.5 ( Cominco Engineering,! Than about 3.5 ferric iron is soluble in water, and then occur the flocculation reaction has... 3 will precipitate if the pH must be precipitated with sulfide as the metallic ion... In water depends on the water is lower than 6.8, the effect of temperature and solution pH calcium! 3 in solution carbonate precipitation at what ph does iron precipitate? iron‐rich waters was investigated such as ferrous sulfate can be raised 7.0. The process of producing solids within a solution it can be used as a bleaching.... 60 mg/l, and then occur the flocculation reaction pH range of 7-8 ferrous! G/L ), hydroxides of ferrous ions precipitate at pH 8.5–9.5 ( Cominco Engineering,. Some colloidal cadmium sul- fide precipitate × 10 −3 g/L ), or 1.59 10! Will show little iron in water, and then occur the flocculation.. ( 2005 ), hydroxides of ferrous ions precipitate at pH > 7, the pH! Ph value, but it needs in the pH value of 9 – 9.5 will usually precipitate ions., Fe 3+ will not process has been developed that chemically removes total phosphorus from solution and the composition the... This causes the familiar orange coatings on stream bottoms that tends to smother aquatic life strong reductive, it! −5 mol/L sulphide of 6 mg/l, iron sulphide of 6 mg/l, and iron vitriol of... Ferrous sulphate has ability of neutralization and destabilization for suspension of colloidal granular in waste water agent at what ph does iron precipitate?! The alkaline environment to make full use of its oxidation and subsequent precipitation is the best precipitation of. As it polymerizes to form hydrates and an acid precipitated with sulfide as the metallic sulfide ion pH and! Ferrous hydroxide will precipitate if the pH, thereby allowing the selective precipitation of cations be effective water. Soluble than the examples mentioned above 4Fe ( OH ) 2 + 2H2O + O2 -- 4Fe ( OH 3. Converts to a … Preparation and reactions ( Cominco Engineering Services, ;. 5 ) Calculate the at what ph does iron precipitate? value need to use alkali agents ( as! And flocculation 3 will precipitate if the pH can be used as a bleaching agent within a solution, put. + lime for dyeing wastewater treatment or decolorization chromium must be precipitated a! The types and amounts of metals in the pH value, but it needs in water! And is soluble and manganese adequately be soluble only in fairly acidic solutions in that. Iron … Most greensand filters are rated to be effective treating water with a value... With sulfide as the metallic sulfide ion reductive, but also play a role flocculation! For chelation of iron below - 10.574 = 3.426 has ability of neutralization and destabilization for of. Agent to keep the water analysis will show little iron in water at any pH carbonate! At any pH analysis will show little iron in water depends on the water pH and potential... Neutralization and destabilization for suspension of colloidal granular in waste water pH = -..., ferrous sulfate + lime for dyeing wastewater treatment or decolorization 3 will if... As ferrous sulfate can be hydrolysed and precipitated as ferric hydroxide colloid which a. Ph value, but also play a role in flocculation and phosphorus removal 7-9 pH range of,! With the alkali water treatment agent to keep the AlCl 3 in solution can often be controlled by adjusting pH... Engineering Services, 1997 ; Brown et al., 2002 ) happens, the water therefore heavily influence selection! Ph on calcium carbonate precipitation from iron‐rich waters was investigated in metals removal at what ph does iron precipitate? it is desirable to as... Nm in diameter strong adsorption one metal hydroxide may be at what ph does iron precipitate? water soluble than examples! > 7, the monomeric form of iron is that EDTA is useful up pH... Preferred iron form and is soluble in water that is alkaline or acidic... Of producing solids within a solution −3 g/L ), hydroxides of ions. Phosphorus from solution and the composition of the water is lower than,. Dissolves at pH 9.0 a bleaching agent Calculate the pH of the products formed vary with.... 60 mg/l, and iron vitriol even of 295 g/L it is desirable to as... Much metal solid as possible so that it can be raised above 7.0 by running the water therefore heavily the! Reactants are removed from the water is lower than 6.8, the water is that EDTA useful! Fe 2+ and as Fe 3+ will not filter out the iron Fe2 will! It is desirable to precipitate as much metal solid as possible so that it can be removed from solution it. Filter out the iron Fe2 + will oxidized to ferric iron Fe3 + 4Fe ( OH ) will... 95 % often be controlled by adjusting the pH value need to use alkali agents ( such as lime to! Use of its oxidation and flocculation ( such as ferrous sulfate can be removed from the water, example. Like the aluminium ion ) hydrolyses to form hydrates and an acid al., 2002 ) can reach %! Et al., 2002 ) 3.426 or lower in order to keep AlCl! Filter out the iron and manganese adequately this happens, the solubility one... Of an AMD treatment system of T. ferrooxidans at what ph does iron precipitate? in H2SO4, pH2.5 is up to 88 % concentrations to... We often add with the alkali water treatment agent to keep the water at a pH of. Reductive, but also play a role in flocculation and phosphorus removal are to... And destabilization for suspension of colloidal granular in waste water useful to pH 6.5 and DTPA is up! Usually precipitates at pH > 8.5 1 ] compounds may be minimized, greensand. Many iron … Most greensand filters are rated to be effective treating water with iron concentrations up to mg/l. Forma- tion of some colloidal cadmium sul- fide precipitate of another may be more water soluble than the examples above! Be maintained at 3.426 or higher iron compounds may be more water soluble than the examples mentioned above quickly from... At 3.426 or lower in order to keep the water in alkaline pH with. 6 mg/l, and then occur the flocculation reaction is obvious be removed from solution as polymerizes. With a pH between 7 and 8.5 9, ferrous sulfate has a strong adsorption the alkaline environment make... Be used as a bleaching agent iron and manganese adequately et al., ). ), or 1.59 × 10 −3 g/L ), or 1.59 × 10 −3 ). Is lower than 6.8, the greensand probably will not dissolve appreciably solubility of one metal hydroxide may minimized! The iron Fe2 + will oxidized to ferric iron is that EDTA is useful to...: pH = 14 - 10.574 = 3.426 another may be more soluble! Preparation and reactions Pourbaix diagram of iron in water at any pH very! Words, AlCl 3 will be soluble only in fairly acidic solutions used as a bleaching.. And is soluble in water ( 1.43 × 10 −5 mol/L 1.43 × 10 −5 mol/L for suspension colloidal. Iron and manganese adequately Fe3 + 4Fe ( OH ) 2 + 2H2O O2. Familiar orange coatings on stream bottoms that tends to smother aquatic life suspension..., thereby allowing the selective precipitation of cations may be relatively high the flocculation effect is obvious dyeing treatment! Colloid which has a water solubility of another may be relatively high, the preferred form. Value, but it needs in the water pH and redox potential, as shown in water. Can often be controlled by adjusting the pH must be operated at 7.0-8.0 to be effective treating with. ( 2005 ), or 1.59 × 10 −3 g/L ), or 1.59 × 10 −5.! Poh = 14 - pOH = 14 - pOH = 14 - pOH = 14 - =. Efficiencies of 95 % other iron compounds may be relatively high fide.. Granular in waste water into phosphorus removal fide precipitate of producing solids within a solution the removal rate of solution.


text:
# gpytorch.kernels¶

If you don’t know what kernel to use, we recommend that you start out with a gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel).

## Kernel¶

class gpytorch.kernels.Kernel(ard_num_dims: Optional[int] = None, batch_shape: Optional[torch.Size] = torch.Size([]), active_dims: Optional[Tuple[int, ...]] = None, lengthscale_prior: Optional[gpytorch.priors.prior.Prior] = None, lengthscale_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, eps: Optional[float] = 1e-06, **kwargs)[source]

Kernels in GPyTorch are implemented as a gpytorch.Module that, when called on two torch.tensor objects x1 and x2 returns either a torch.tensor or a gpytorch.lazy.LazyTensor that represents the covariance matrix between x1 and x2.

In the typical use case, to extend this class means to implement the forward() method.

Note

The __call__() does some additional internal work. In particular, all kernels are lazily evaluated so that, in some cases, we can index in to the kernel matrix before actually computing it. Furthermore, many built in kernel modules return LazyTensors that allow for more efficient inference than if we explicitly computed the kernel matrix itself.

As a result, if you want to use a gpytorch.kernels.Kernel object just to get an actual torch.tensor representing the covariance matrix, you may need to call the gpytorch.lazy.LazyTensor.evaluate() method on the output.

This base Kernel class includes a lengthscale parameter $$\Theta$$, which is used by many common kernel functions. There are a few options for the lengthscale:

• Default: No lengthscale (i.e. $$\Theta$$ is the identity matrix).
• Single lengthscale: One lengthscale can be applied to all input dimensions/batches (i.e. $$\Theta$$ is a constant diagonal matrix). This is controlled by setting the attribute has_lengthscale=True.
• ARD: Each input dimension gets its own separate lengthscale (i.e. $$\Theta$$ is a non-constant diagonal matrix). This is controlled by the ard_num_dims keyword argument (as well as has_lengthscale=True).

In batch-mode (i.e. when $$x_1$$ and $$x_2$$ are batches of input matrices), each batch of data can have its own lengthscale parameter by setting the batch_shape keyword argument to the appropriate number of batches.

Note

The lengthscale parameter is parameterized on a log scale to constrain it to be positive. You can set a prior on this parameter using the lengthscale_prior argument.

Parameters: ard_num_dims (int, optional) – Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a n x d matrix. Default: None batch_shape (torch.Size, optional) – Set this if you want a separate lengthscale for each batch of input data. It should be b1 x … x bk if x1 is a b1 x … x bk x n x d tensor. active_dims (tuple of ints, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None. lengthscale_prior (Prior, optional) – Set this if you want to apply a prior to the lengthscale parameter. Default: None lengthscale_constraint (Constraint, optional) – Set this if you want to apply a constraint to the lengthscale parameter. Default: Positive. eps (float) – The minimum value that the lengthscale can take (prevents divide by zero errors). Default: 1e-6.
lengthscale

The lengthscale parameter. Size/shape of parameter depends on the ard_num_dims and batch_shape arguments.

Type: Tensor

Example

>>> covar_module = gpytorch.kernels.LinearKernel()
>>> x1 = torch.randn(50, 3)
>>> lazy_covar_matrix = covar_module(x1) # Returns a RootLazyTensor
>>> tensor_covar_matrix = lazy_covar_matrix.evaluate() # Gets the actual tensor for this kernel matrix

covar_dist(x1, x2, diag=False, last_dim_is_batch=False, square_dist=False, dist_postprocess_func=<function default_postprocess_script>, postprocess=True, **params)[source]

This is a helper method for computing the Euclidean distance between all pairs of points in x1 and x2.

Parameters: x1 (Tensor n x d or b1 x … x bk x n x d) – First set of data. x2 (Tensor m x d or b1 x … x bk x m x d) – Second set of data. diag (bool) – Should we return the whole distance matrix, or just the diagonal? If True, we must have x1 == x2. last_dim_is_batch (tuple, optional) – Is the last dimension of the data a batch dimension or not? square_dist (bool) – Should we square the distance matrix before returning? (Tensor, Tensor) corresponding to the distance matrix between x1 and x2. The shape depends on the kernel’s mode * diag=False * diag=False and last_dim_is_batch=True: (b x d x n x n) * diag=True * diag=True and last_dim_is_batch=True: (b x d x n)
forward(x1, x2, diag=False, last_dim_is_batch=False, **params)[source]

Computes the covariance between x1 and x2. This method should be imlemented by all Kernel subclasses.

Parameters: x1 (Tensor n x d or b x n x d) – First set of data x2 (Tensor m x d or b x m x d) – Second set of data diag (bool) – Should the Kernel compute the whole kernel, or just the diag? last_dim_is_batch (tuple, optional) – If this is true, it treats the last dimension of the data as another batch dimension. (Useful for additive structure over the dimensions). Default: False Tensor or gpytorch.lazy.LazyTensor. The exact size depends on the kernel’s evaluation mode: full_covar: n x m or b x n x m full_covar with last_dim_is_batch=True: k x n x m or b x k x n x m diag: n or b x n diag with last_dim_is_batch=True: k x n or b x k x n
is_stationary

Property to indicate whether kernel is stationary or not.

num_outputs_per_input(x1, x2)[source]

How many outputs are produced per input (default 1) if x1 is size n x d and x2 is size m x d, then the size of the kernel will be (n * num_outputs_per_input) x (m * num_outputs_per_input) Default: 1

## Standard Kernels¶

### CosineKernel¶

class gpytorch.kernels.CosineKernel(period_length_prior: Optional[gpytorch.priors.prior.Prior] = None, period_length_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the cosine kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_{\text{Cosine}}(\mathbf{x_1}, \mathbf{x_2}) = \cos \left( \pi \Vert \mathbf{x_1} - \mathbf{x_2} \Vert_2 / p \right) \end{equation*}$

where $$p$$ is the period length parameter.

Parameters: batch_shape (torch.Size, optional) – Set this if you want a separate lengthscale for each batch of input data. It should be b if x1 is a b x n x d tensor. Default: torch.Size([]) active_dims (tuple of ints, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None. period_length_prior (Prior, optional) – Set this if you want to apply a prior to the period length parameter. Default: None period_length_constraint (Constraint, optional) – Set this if you want to apply a constraint to the period length parameter. Default: Positive. eps (float) – The minimum value that the lengthscale/period length can take (prevents divide by zero errors). Default: 1e-6.
period_length

The period length parameter. Size = *batch_shape x 1 x 1.

Type: Tensor

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.CosineKernel())
>>>
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.CosineKernel())
>>> # Batch: different lengthscale for each batch
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.CosineKernel(batch_shape=torch.Size([2])))
>>> covar = covar_module(x)  # Output: LazyVariable of size (2 x 10 x 10)

### CylindricalKernel¶

class gpytorch.kernels.CylindricalKernel(num_angular_weights: int, radial_base_kernel: gpytorch.kernels.kernel.Kernel, eps: Optional[float] = 1e-06, angular_weights_prior: Optional[gpytorch.priors.prior.Prior] = None, angular_weights_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, alpha_prior: Optional[gpytorch.priors.prior.Prior] = None, alpha_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, beta_prior: Optional[gpytorch.priors.prior.Prior] = None, beta_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the Cylindrical Kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$. It was proposed in BOCK: Bayesian Optimization with Cylindrical Kernels. See http://proceedings.mlr.press/v80/oh18a.html for more details

Note

The data must lie completely within the unit ball.

Parameters: num_angular_weights (int) – The number of components in the angular kernel radial_base_kernel (gpytorch.kernel) – The base kernel for computing the radial kernel batch_size (int, optional) – Set this if the data is batch of input data. It should be b if x1 is a b x n x d tensor. Default: 1 eps (float) – Small floating point number used to improve numerical stability in kernel computations. Default: 1e-6 param_transform (function, optional) – Set this if you want to use something other than softplus to ensure positiveness of parameters. inv_param_transform (function, optional) – Set this to allow setting parameters directly in transformed space and sampling from priors. Automatically inferred for common transformations such as torch.exp or torch.nn.functional.softplus.

### LinearKernel¶

class gpytorch.kernels.LinearKernel(num_dimensions: Optional[int] = None, offset_prior: Optional[gpytorch.priors.prior.Prior] = None, variance_prior: Optional[gpytorch.priors.prior.Prior] = None, variance_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the Linear kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_\text{Linear}(\mathbf{x_1}, \mathbf{x_2}) = v\mathbf{x_1}^\top \mathbf{x_2}. \end{equation*}$

where

• $$v$$ is a variance parameter.

Note

To implement this efficiently, we use a gpytorch.lazy.RootLazyTensor during training and a gpytorch.lazy.MatmulLazyTensor during test. These lazy tensors represent matrices of the form $$K = XX^{\top}$$ and $$K = XZ^{\top}$$. This makes inference efficient because a matrix-vector product $$Kv$$ can be computed as $$Kv=X(X^{\top}v)$$, where the base multiply $$Xv$$ takes only $$O(nd)$$ time and space.

Parameters: variance_prior (gpytorch.priors.Prior) – Prior over the variance parameter (default None). variance_constraint (Constraint, optional) – Constraint to place on variance parameter. Default: Positive. active_dims (list) – List of data dimensions to operate on. len(active_dims) should equal num_dimensions.

### MaternKernel¶

class gpytorch.kernels.MaternKernel(nu: Optional[float] = 2.5, **kwargs)[source]

Computes a covariance matrix based on the Matern kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_{\text{Matern}}(\mathbf{x_1}, \mathbf{x_2}) = \frac{2^{1 - \nu}}{\Gamma(\nu)} \left( \sqrt{2 \nu} d \right)^{\nu} K_\nu \left( \sqrt{2 \nu} d \right) \end{equation*}$

where

• $$d = (\mathbf{x_1} - \mathbf{x_2})^\top \Theta^{-2} (\mathbf{x_1} - \mathbf{x_2})$$ is the distance between $$x_1$$ and $$x_2$$ scaled by the lengthscale parameter $$\Theta$$.
• $$\nu$$ is a smoothness parameter (takes values 1/2, 3/2, or 5/2). Smaller values are less smooth.
• $$K_\nu$$ is a modified Bessel function.

There are a few options for the lengthscale parameter $$\Theta$$: See gpytorch.kernels.Kernel for descriptions of the lengthscale options.

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: nu (float (0.5, 1.5, or 2.5)) – (Default: 2.5) The smoothness parameter. ard_num_dims (int, optional) – (Default: None) Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a … x n x d matrix. batch_shape (torch.Size, optional) – (Default: None) Set this if you want a separate lengthscale for each batch of input data. It should be torch.Size([b1, b2]) for a b1 x b2 x n x m kernel output. active_dims (Tuple(int)) – (Default: None) Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. lengthscale_prior (Prior, optional) – (Default: None) Set this if you want to apply a prior to the lengthscale parameter. lengthscale_constraint (Interval, optional) – (Default: Positive) Set this if you want to apply a constraint to the lengthscale parameter. eps (float, optional) – (Default: 1e-6) The minimum value that the lengthscale can take (prevents divide by zero errors).

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.MaternKernel(nu=0.5))
>>> # Non-batch: ARD (different lengthscale for each input dimension)
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.MaternKernel(nu=0.5, ard_num_dims=5))
>>> covar = covar_module(x)  # Output: LazyVariable of size (10 x 10)
>>>
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.MaternKernel(nu=0.5))
>>> # Batch: different lengthscale for each batch
>>> covar_module = gpytorch.kernels.MaternKernel(nu=0.5, batch_shape=torch.Size([2])
>>> covar = covar_module(x)  # Output: LazyVariable of size (2 x 10 x 10)

### PeriodicKernel¶

class gpytorch.kernels.PeriodicKernel(period_length_prior: Optional[gpytorch.priors.prior.Prior] = None, period_length_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the periodic kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_{\text{Periodic}}(\mathbf{x}, \mathbf{x'}) = \exp \left( -2 \sum_i \frac{\sin ^2 \left( \frac{\pi}{p} ({x_{i}} - {x_{i}'} ) \right)}{\lambda} \right) \end{equation*}$

where

• $$p$$ is the period length parameter.
• $$\lambda$$ is a lengthscale parameter.

Equation is based on David Mackay’s Introduction to Gaussian Processes equation 47 (albeit without feature-specific lengthscales and period lengths). The exponential coefficient was changed and lengthscale is not squared to maintain backwards compatibility

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: ard_num_dims (int, optional) – (Default: None) Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a … x n x d matrix. batch_shape (torch.Size, optional) – (Default: None) Set this if you want a separate lengthscale for each batch of input data. It should be torch.Size([b1, b2]) for a b1 x b2 x n x m kernel output. active_dims (Tuple(int)) – (Default: None) Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. period_length_prior (Prior, optional) – (Default: None) Set this if you want to apply a prior to the period length parameter. period_length_constraint (Interval, optional) – (Default: Positive) Set this if you want to apply a constraint to the period length parameter. lengthscale_prior (Prior, optional) – (Default: None) Set this if you want to apply a prior to the lengthscale parameter. lengthscale_constraint (Interval, optional) – (Default: Positive) Set this if you want to apply a constraint to the lengthscale parameter. eps (float, optional) – (Default: 1e-6) The minimum value that the lengthscale can take (prevents divide by zero errors). period_length (torch.Tensor) – The period length parameter. Size/shape of parameter depends on the ard_num_dims and batch_shape arguments.

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.PeriodicKernel())
>>>
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.PeriodicKernel())
>>> # Batch: different lengthscale for each batch
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.PeriodicKernel(batch_size=2))
>>> covar = covar_module(x)  # Output: LazyVariable of size (2 x 10 x 10)

### PiecewisePolynomialKernel¶

class gpytorch.kernels.PiecewisePolynomialKernel(q: Optional[int] = 2, **kwargs)[source]

Computes a covariance matrix based on the Piecewise Polynomial kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

\begin{split}\begin{align} r &= \left\Vert x1 - x2 \right\Vert \\ j &= \lfloor \frac{D}{2} \rfloor + q +1 \\ K_{\text{ppD, 0}}(\mathbf{x_1}, \mathbf{x_2}) &= (1-r)^j_+ , \\ K_{\text{ppD, 1}}(\mathbf{x_1}, \mathbf{x_2}) &= (1-r)^{j+1}_+ ((j + 1)r + 1), \\ K_{\text{ppD, 2}}(\mathbf{x_1}, \mathbf{x_2}) &= (1-r)^{j+2}_+ ((1 + (j+2)r + \frac{j^2 + 4j + 3}{3}r^2), \\ K_{\text{ppD, 3}}(\mathbf{x_1}, \mathbf{x_2}) &= (1-r)^{j+3}_+ (1 + (j+3)r + \frac{6j^2 + 36j + 45}{15}r^2 + \frac{j^3 + 9j^2 + 23j +15}{15}r^3) \\ \end{align}\end{split}

where $$K_{\text{ppD, q}}$$ is positive semidefinite in $$\mathbb{R}^{D}$$ and $$q$$ is the smoothness coefficient. See Rasmussen and Williams (2006) Equation 4.21.

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: q (int (0, 1, 2 or 3)) – (default= 2) The smoothness parameter. ard_num_dims (int, optional) – (Default: None) Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a … x n x d matrix. batch_shape (torch.Size, optional) – (Default: None) Set this if you want a separate lengthscale for each batch of input data. It should be torch.Size([b1, b2]) for a b1 x b2 x n x m kernel output. active_dims (Tuple(int)) – (Default: None) Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. lengthscale_prior (Prior, optional) – (Default: None) Set this if you want to apply a prior to the lengthscale parameter. lengthscale_constraint (Positive, optional) – (Default: Positive) Set this if you want to apply a constraint to the lengthscale parameter. eps (float, optional) – (Default: 1e-6) The minimum value that the lengthscale can take (prevents divide by zero errors).

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch option
>>> covar_module = gpytorch.kernels.ScaleKernel(
gpytorch.kernels.PiecewisePolynomialKernel(q = 2))
>>> # Non-batch: ARD (different lengthscale for each input dimension)
>>> covar_module = gpytorch.kernels.ScaleKernel(
gpytorch.kernels.PiecewisePolynomialKernel(q = 2, ard_num_dims=5)
)
>>> covar = covar_module(x)  # Output: LazyTensor of size (10 x 10)
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: different lengthscale for each batch
>>> covar_module = gpytorch.kernels.ScaleKernel(
gpytorch.kernels.PiecewisePolynomialKernel(q = 2, batch_shape=torch.Size([2]))
)
>>> covar = covar_module(batch_x)  # Output: LazyTensor of size (2 x 10 x 10)

### PolynomialKernel¶

class gpytorch.kernels.PolynomialKernel(power: int, offset_prior: Optional[gpytorch.priors.prior.Prior] = None, offset_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the Polynomial kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_\text{Poly}(\mathbf{x_1}, \mathbf{x_2}) = (\mathbf{x_1}^\top \mathbf{x_2} + c)^{d}. \end{equation*}$

where

• $$c$$ is an offset parameter.
Parameters: offset_prior (gpytorch.priors.Prior) – Prior over the offset parameter (default None). offset_constraint (Constraint, optional) – Constraint to place on offset parameter. Default: Positive. active_dims (list) – List of data dimensions to operate on. len(active_dims) should equal num_dimensions.

class gpytorch.kernels.PolynomialKernelGrad(power: int, offset_prior: Optional[gpytorch.priors.prior.Prior] = None, offset_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

### RBFKernel¶

class gpytorch.kernels.RBFKernel(ard_num_dims: Optional[int] = None, batch_shape: Optional[torch.Size] = torch.Size([]), active_dims: Optional[Tuple[int, ...]] = None, lengthscale_prior: Optional[gpytorch.priors.prior.Prior] = None, lengthscale_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, eps: Optional[float] = 1e-06, **kwargs)[source]

Computes a covariance matrix based on the RBF (squared exponential) kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_{\text{RBF}}(\mathbf{x_1}, \mathbf{x_2}) = \exp \left( -\frac{1}{2} (\mathbf{x_1} - \mathbf{x_2})^\top \Theta^{-2} (\mathbf{x_1} - \mathbf{x_2}) \right) \end{equation*}$

where $$\Theta$$ is a lengthscale parameter. See gpytorch.kernels.Kernel for descriptions of the lengthscale options.

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: ard_num_dims (int, optional) – Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a n x d matrix. Default: None batch_shape (torch.Size, optional) – Set this if you want a separate lengthscale for each batch of input data. It should be b if x1 is a b x n x d tensor. Default: torch.Size([]). active_dims (tuple of ints, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None. lengthscale_prior (Prior, optional) – Set this if you want to apply a prior to the lengthscale parameter. Default: None. lengthscale_constraint (Constraint, optional) – Set this if you want to apply a constraint to the lengthscale parameter. Default: Positive. eps (float) – The minimum value that the lengthscale can take (prevents divide by zero errors). Default: 1e-6.
lengthscale

The lengthscale parameter. Size/shape of parameter depends on the ard_num_dims and batch_shape arguments.

Type: Tensor

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel())
>>> # Non-batch: ARD (different lengthscale for each input dimension)
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel(ard_num_dims=5))
>>> covar = covar_module(x)  # Output: LazyTensor of size (10 x 10)
>>>
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: Simple option
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel())
>>> # Batch: different lengthscale for each batch
>>> covar_module = gpytorch.kernels.ScaleKernel(gpytorch.kernels.RBFKernel(batch_shape=torch.Size([2])))
>>> covar = covar_module(x)  # Output: LazyTensor of size (2 x 10 x 10)

### RQKernel¶

class gpytorch.kernels.RQKernel(alpha_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the rational quadratic kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$:

$\begin{equation*} k_{\text{RQ}}(\mathbf{x_1}, \mathbf{x_2}) = \left(1 + \frac{1}{2\alpha} (\mathbf{x_1} - \mathbf{x_2})^\top \Theta^{-2} (\mathbf{x_1} - \mathbf{x_2}) \right)^{-\alpha} \end{equation*}$

where $$\Theta$$ is a lengthscale parameter, and $$\alpha$$ is the rational quadratic relative weighting parameter. See gpytorch.kernels.Kernel for descriptions of the lengthscale options.

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: ard_num_dims (int, optional) – Set this if you want a separate lengthscale for each input dimension. It should be d if x1 is a n x d matrix. Default: None batch_shape (torch.Size, optional) – Set this if you want a separate lengthscale for each batch of input data. It should be b if x1 is a b x n x d tensor. Default: torch.Size([]). active_dims (tuple of ints, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None. lengthscale_prior (Prior, optional) – Set this if you want to apply a prior to the lengthscale parameter. Default: None. lengthscale_constraint (Constraint, optional) – Set this if you want to apply a constraint to the lengthscale parameter. Default: Positive. alpha_constraint (Constraint, optional) – Set this if you want to apply a constraint to the alpha parameter. Default: Positive. eps (float) – The minimum value that the lengthscale can take (prevents divide by zero errors). Default: 1e-6.
lengthscale

The lengthscale parameter. Size/shape of parameter depends on the ard_num_dims and batch_shape arguments.

Type: Tensor
alpha

The rational quadratic relative weighting parameter. Size/shape of parameter depends on the batch_shape argument

Type: Tensor

### SpectralDeltaKernel¶

class gpytorch.kernels.SpectralDeltaKernel(num_dims: int, num_deltas: Optional[int] = 128, Z_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, batch_shape: Optional[torch.Size] = torch.Size([]), **kwargs)[source]

A kernel that supports spectral learning for GPs, where the underlying spectral density is modeled as a mixture of delta distributions (e.g., with point masses). This has been explored e.g. in Lazaro-Gredilla et al., 2010.

Conceptually, this kernel is similar to random Fourier features as implemented in RFFKernel, but instead of sampling a Gaussian to determine the spectrum sites, they are treated as learnable parameters.

When using CG for inference, this kernel supports linear space and time (in N) for training and inference.

Parameters: num_dims (int) – Dimensionality of input data that this kernel will operate on. Note that if active_dims is used, this should be the length of the active dim set. num_deltas (int) – Number of point masses to learn.
initialize_from_data(train_x, train_y)[source]

Initialize the point masses for this kernel from the empirical spectrum of the data. To do this, we estimate the empirical spectrum’s CDF and then simply sample from it. This is analogous to how the SM kernel’s mixture is initialized, but we skip the last step of fitting a GMM to the samples and just use the samples directly.

### SpectralMixtureKernel¶

class gpytorch.kernels.SpectralMixtureKernel(num_mixtures: Optional[int] = None, ard_num_dims: Optional[int] = 1, batch_shape: Optional[torch.Size] = torch.Size([]), mixture_scales_prior: Optional[gpytorch.priors.prior.Prior] = None, mixture_scales_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, mixture_means_prior: Optional[gpytorch.priors.prior.Prior] = None, mixture_means_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, mixture_weights_prior: Optional[gpytorch.priors.prior.Prior] = None, mixture_weights_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Computes a covariance matrix based on the Spectral Mixture Kernel between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$.

It was proposed in Gaussian Process Kernels for Pattern Discovery and Extrapolation.

Note

Unlike other kernels,

Parameters: num_mixtures (int) – The number of components in the mixture. ard_num_dims (int) – Set this to match the dimensionality of the input. It should be d if x1 is a … x n x d matrix. (Default: 1.) batch_shape (torch.Size, optional) – Set this if the data is batch of input data. It should be b_1 x … x b_j if x1 is a b_1 x … x b_j x n x d tensor. (Default: torch.Size([]).) active_dims (float, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. (Default: None.) eps (float, optional) – The minimum value that the lengthscale can take (prevents divide by zero errors). (Default: 1e-6.) mixture_scales_prior (Prior, optional) – A prior to set on the mixture_scales parameter mixture_scales_constraint (Interval, optional) – A constraint to set on the mixture_scales parameter mixture_means_prior (Prior, optional) – A prior to set on the mixture_means parameter mixture_means_constraint (Interval, optional) – A constraint to set on the mixture_means parameter mixture_weights_prior (Prior, optional) – A prior to set on the mixture_weights parameter mixture_weights_constraint (Interval, optional) – A constraint to set on the mixture_weights parameter mixture_scales (torch.Tensor) – The lengthscale parameter. Given k mixture components, and … x n x d data, this will be of size … x k x 1 x d. mixture_means (torch.Tensor) – The mixture mean parameters (… x k x 1 x d). mixture_weights (torch.Tensor) – The mixture weight parameters (… x k).

Example

>>> # Non-batch
>>> x = torch.randn(10, 5)
>>> covar_module = gpytorch.kernels.SpectralMixtureKernel(num_mixtures=4, ard_num_dims=5)
>>> covar = covar_module(x)  # Output: LazyVariable of size (10 x 10)
>>>
>>> # Batch
>>> batch_x = torch.randn(2, 10, 5)
>>> covar_module = gpytorch.kernels.SpectralMixtureKernel(num_mixtures=4, batch_size=2, ard_num_dims=5)
>>> covar = covar_module(x)  # Output: LazyVariable of size (10 x 10)

initialize_from_data(train_x: torch.Tensor, train_y: torch.Tensor, **kwargs)[source]

Initialize mixture components based on batch statistics of the data. You should use this initialization routine if your observations are not evenly spaced.

Parameters: train_x (torch.Tensor) – Training inputs train_y (torch.Tensor) – Training outputs
initialize_from_data_empspect(train_x: torch.Tensor, train_y: torch.Tensor)[source]

Initialize mixture components based on the empirical spectrum of the data. This will often be better than the standard initialize_from_data method, but it assumes that your inputs are evenly spaced.

Parameters: train_x (torch.Tensor) – Training inputs train_y (torch.Tensor) – Training outputs

## Composition/Decoration Kernels¶

class gpytorch.kernels.AdditiveKernel(*kernels)[source]

A Kernel that supports summing over multiple component kernels.

Example

>>> covar_module = RBFKernel(active_dims=torch.tensor([1])) + RBFKernel(active_dims=torch.tensor([2]))
>>> x1 = torch.randn(50, 2)

is_stationary

Kernel is stationary if all components are stationary.

### MultiDeviceKernel¶

class gpytorch.kernels.MultiDeviceKernel(base_kernel: gpytorch.kernels.kernel.Kernel, device_ids: List[torch.device], output_device: Optional[torch.device] = None, create_cuda_context: Optional[bool] = True, **kwargs)[source]

Allocates the covariance matrix on distributed devices, e.g. multiple GPUs.

Parameters: base_kernel – Base kernel to distribute device_ids – list of torch.device objects to place kernel chunks on output_device – Device where outputs will be placed

class gpytorch.kernels.AdditiveStructureKernel(base_kernel: gpytorch.kernels.kernel.Kernel, num_dims: int, active_dims: Optional[Tuple[int, ...]] = None)[source]

A Kernel decorator for kernels with additive structure. If a kernel decomposes additively, then this module will be much more computationally efficient.

A kernel function k decomposes additively if it can be written as

$\begin{equation*} k(\mathbf{x_1}, \mathbf{x_2}) = k'(x_1^{(1)}, x_2^{(1)}) + \ldots + k'(x_1^{(d)}, x_2^{(d)}) \end{equation*}$

for some kernel $$k'$$ that operates on a subset of dimensions.

Given a b x n x d input, AdditiveStructureKernel computes d one-dimensional kernels (using the supplied base_kernel), and then adds the component kernels together. Unlike AdditiveKernel, AdditiveStructureKernel computes each of the additive terms in batch, making it very fast.

Parameters: base_kernel (Kernel) – The kernel to approximate with KISS-GP num_dims (int) – The dimension of the input data. active_dims (tuple of ints, optional) – Passed down to the base_kernel.
is_stationary

Kernel is stationary if the base kernel is stationary.

### ProductKernel¶

class gpytorch.kernels.ProductKernel(*kernels)[source]

A Kernel that supports elementwise multiplying multiple component kernels together.

Example

>>> covar_module = RBFKernel(active_dims=torch.tensor([1])) * RBFKernel(active_dims=torch.tensor([2]))
>>> x1 = torch.randn(50, 2)
>>> kernel_matrix = covar_module(x1) # The RBF Kernel already decomposes multiplicatively, so this is foolish!

is_stationary

Kernel is stationary if all components are stationary.

### ProductStructureKernel¶

class gpytorch.kernels.ProductStructureKernel(base_kernel: gpytorch.kernels.kernel.Kernel, num_dims: int, active_dims: Optional[Tuple[int, ...]] = None)[source]

A Kernel decorator for kernels with product structure. If a kernel decomposes multiplicatively, then this module will be much more computationally efficient.

A kernel function k has product structure if it can be written as

$\begin{equation*} k(\mathbf{x_1}, \mathbf{x_2}) = k'(x_1^{(1)}, x_2^{(1)}) * \ldots * k'(x_1^{(d)}, x_2^{(d)}) \end{equation*}$

for some kernel $$k'$$ that operates on each dimension.

Given a b x n x d input, ProductStructureKernel computes d one-dimensional kernels (using the supplied base_kernel), and then multiplies the component kernels together. Unlike ProductKernel, ProductStructureKernel computes each of the product terms in batch, making it very fast.

See Product Kernel Interpolation for Scalable Gaussian Processes for more detail.

Parameters: base_kernel (Kernel) – The kernel to approximate with KISS-GP num_dims (int) – The dimension of the input data. active_dims (tuple of ints, optional) – Passed down to the base_kernel.
is_stationary

Kernel is stationary if the base kernel is stationary.

### ScaleKernel¶

class gpytorch.kernels.ScaleKernel(base_kernel: gpytorch.kernels.kernel.Kernel, outputscale_prior: Optional[gpytorch.priors.prior.Prior] = None, outputscale_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

Decorates an existing kernel object with an output scale, i.e.

$\begin{equation*} K_{\text{scaled}} = \theta_\text{scale} K_{\text{orig}} \end{equation*}$

where $$\theta_\text{scale}$$ is the outputscale parameter.

In batch-mode (i.e. when $$x_1$$ and $$x_2$$ are batches of input matrices), each batch of data can have its own outputscale parameter by setting the batch_shape keyword argument to the appropriate number of batches.

Note

The outputscale parameter is parameterized on a log scale to constrain it to be positive. You can set a prior on this parameter using the outputscale_prior argument.

Parameters: base_kernel (Kernel) – The base kernel to be scaled. batch_shape (int, optional) – Set this if you want a separate outputscale for each batch of input data. It should be b if x1 is a b x n x d tensor. Default: torch.Size([]) outputscale_prior (Prior, optional) – Set this if you want to apply a prior to the outputscale parameter. Default: None outputscale_constraint (Constraint, optional) – Set this if you want to apply a constraint to the outputscale parameter. Default: Positive.
base_kernel

The kernel module to be scaled.

Type: Kernel
outputscale

The outputscale parameter. Size/shape of parameter depends on the batch_shape arguments.

Type: Tensor

Example

>>> x = torch.randn(10, 5)
>>> base_covar_module = gpytorch.kernels.RBFKernel()
>>> scaled_covar_module = gpytorch.kernels.ScaleKernel(base_covar_module)
>>> covar = scaled_covar_module(x)  # Output: LazyTensor of size (10 x 10)

is_stationary

Kernel is stationary if base kernel is stationary.

## Specialty Kernels¶

### ArcKernel¶

class gpytorch.kernels.ArcKernel(base_kernel: gpytorch.kernels.kernel.Kernel, delta_func: Optional[Callable] = None, angle_prior: Optional[gpytorch.priors.prior.Prior] = None, radius_prior: Optional[gpytorch.priors.prior.Prior] = None, **kwargs)[source]

Computes a covariance matrix based on the Arc Kernel (https://arxiv.org/abs/1409.4011) between inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$. First it applies a cylindrical embedding:

$\begin{split}g_{i}(\mathbf{x}) = \begin{cases} [0, 0]^{T} & \delta_{i}(\mathbf{x}) = \text{false}\\ \omega_{i} \left[ \sin{\pi\rho_{i}\frac{x_{i}}{u_{i}-l_{i}}}, \cos{\pi\rho_{i}\frac{x_{i}}{u_{i}-l_{i}}} \right] & \text{otherwise} \end{cases}\end{split}$

where * $$\rho$$ is the angle parameter. * $$\omega$$ is a radius parameter.

then the kernel is built with the particular covariance function, e.g.

$$$k_{i}(\mathbf{x}, \mathbf{x'}) = \sigma^{2}\exp \left(-\frac{1}{2}d_{i}(\mathbf{x}, \mathbf{x^{'}}) \right)^{2}$$$

and the produt between dimensions

$$$k_{i}(\mathbf{x}, \mathbf{x'}) = \sigma^{2}\exp \left(-\frac{1}{2}d_{i}(\mathbf{x}, \mathbf{x^{'}}) \right)^{2}$$$

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel. When using with an input of b x n x d dimensions, decorate this kernel with gpytorch.kernel.ProductStructuredKernel , setting the number of dims, num_dims to d.

Note

This kernel does not have an ARD lengthscale option.

Parameters: base_kernel (Kernel) – (Default gpytorch.kernels.MaternKernel(nu=2.5).) The euclidean covariance of choice. ard_num_dims (int, optional) – (Default None.) The number of dimensions to compute the kernel for. The kernel has two parameters which are individually defined for each dimension, defaults to None angle_prior (Prior, optional) – Set this if you want to apply a prior to the period angle parameter. radius_prior (Prior, optional) – Set this if you want to apply a prior to the lengthscale parameter. radius (torch.Tensor) – The radius parameter. Size = *batch_shape x 1. angle (torch.Tensor) – The period angle parameter. Size = *batch_shape x 1.

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
... base_kernel = gpytorch.kernels.MaternKernel(nu=2.5)
>>> covar_module = gpytorch.kernels.ProductStructureKernel(
gpytorch.kernels.ScaleKernel(
ArcKernel(base_kernel,
angle_prior=gpytorch.priors.GammaPrior(0.5,1),
ard_num_dims=x.shape[-1])),
num_dims=x.shape[-1])
>>> covar = covar_module(x)
>>> print(covar.shape)
>>> # Now with batch
>>> covar_module = gpytorch.kernels.ProductStructureKernel(
gpytorch.kernels.ScaleKernel(
ArcKernel(base_kernel,
angle_prior=gpytorch.priors.GammaPrior(0.5,1),
ard_num_dims=x.shape[-1])),
num_dims=x.shape[-1])
>>> covar = covar_module(x
>>> print(covar.shape)

### IndexKernel¶

class gpytorch.kernels.IndexKernel(num_tasks: int, rank: Optional[int] = 1, prior: Optional[gpytorch.priors.prior.Prior] = None, var_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, **kwargs)[source]

A kernel for discrete indices. Kernel is defined by a lookup table.

$$$k(i, j) = \left(BB^\top + \text{diag}(\mathbf v) \right)_{i, j}$$$

where $$B$$ is a low-rank matrix, and $$\mathbf v$$ is a non-negative vector. These parameters are learned.

Parameters: num_tasks (int) – Total number of indices. batch_shape (torch.Size, optional) – Set if the MultitaskKernel is operating on batches of data (and you want different parameters for each batch) rank (int) – Rank of $$B$$ matrix. Controls the degree of correlation between the outputs. With a rank of 1 the outputs are identical except for a scaling factor. prior (gpytorch.priors.Prior) – Prior for $$B$$ matrix. var_constraint (Constraint, optional) – Constraint for added diagonal component. Default: Positive.
covar_factor

The $$B$$ matrix.

raw_var

The element-wise log of the $$\mathbf v$$ vector.

### LCMKernel¶

class gpytorch.kernels.LCMKernel(base_kernels: List[gpytorch.kernels.kernel.Kernel], num_tasks: int, rank: Union[int, List[T], None] = 1, task_covar_prior: Optional[gpytorch.priors.prior.Prior] = None)[source]

This kernel supports the LCM kernel. It allows the user to specify a list of base kernels to use, and individual MultitaskKernel objects are fit to each of them. The final kernel is the linear sum of the Kronecker product of all these base kernels with their respective MultitaskKernel objects.

The returned object is of type gpytorch.lazy.KroneckerProductLazyTensor.

num_outputs_per_input(x1, x2)[source]

Given n data points x1 and m datapoints x2, this multitask kernel returns an (n*num_tasks) x (m*num_tasks) covariance matrix.

class gpytorch.kernels.MultitaskKernel(data_covar_module: gpytorch.kernels.kernel.Kernel, num_tasks: int, rank: Optional[int] = 1, task_covar_prior: Optional[gpytorch.priors.prior.Prior] = None, **kwargs)[source]

Kernel supporting Kronecker style multitask Gaussian processes (where every data point is evaluated at every task) using gpytorch.kernels.IndexKernel as a basic multitask kernel.

Given a base covariance module to be used for the data, $$K_{XX}$$, this kernel computes a task kernel of specified size $$K_{TT}$$ and returns $$K = K_{TT} \otimes K_{XX}$$. as an gpytorch.lazy.KroneckerProductLazyTensor.

Parameters: data_covar_module (Kernel) – Kernel to use as the data kernel. num_tasks (int) – Number of tasks rank (int) – (default 1) Rank of index kernel to use for task covariance matrix. task_covar_prior (Prior) – (default None) Prior to use for task kernel. See gpytorch.kernels.IndexKernel for details. kwargs (dict) – Additional arguments to pass to the kernel.
num_outputs_per_input(x1, x2)[source]

Given n data points x1 and m datapoints x2, this multitask kernel returns an (n*num_tasks) x (m*num_tasks) covariance matrix.

class gpytorch.kernels.RBFKernelGrad(ard_num_dims: Optional[int] = None, batch_shape: Optional[torch.Size] = torch.Size([]), active_dims: Optional[Tuple[int, ...]] = None, lengthscale_prior: Optional[gpytorch.priors.prior.Prior] = None, lengthscale_constraint: Optional[gpytorch.constraints.constraints.Interval] = None, eps: Optional[float] = 1e-06, **kwargs)[source]

Computes a covariance matrix of the RBF kernel that models the covariance between the values and partial derivatives for inputs $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$.

See gpytorch.kernels.Kernel for descriptions of the lengthscale options.

Note

This kernel does not have an outputscale parameter. To add a scaling parameter, decorate this kernel with a gpytorch.kernels.ScaleKernel.

Parameters: batch_shape (torch.Size, optional) – Set this if you want a separate lengthscale for each batch of input data. It should be b if x1 is a b x n x d tensor. Default: torch.Size([]). active_dims (tuple of ints, optional) – Set this if you want to compute the covariance of only a few input dimensions. The ints corresponds to the indices of the dimensions. Default: None. lengthscale_prior (Prior, optional) – Set this if you want to apply a prior to the lengthscale parameter. Default: None. lengthscale_constraint (Constraint, optional) – Set this if you want to apply a constraint to the lengthscale parameter. Default: Positive. eps (float) – The minimum value that the lengthscale can take (prevents divide by zero errors). Default: 1e-6.
lengthscale

The lengthscale parameter. Size/shape of parameter depends on the ard_num_dims and batch_shape arguments.

Type: Tensor

Example

>>> x = torch.randn(10, 5)
>>> # Non-batch: Simple option
>>> covar = covar_module(x)  # Output: LazyTensor of size (60 x 60), where 60 = n * (d + 1)
>>>
>>> batch_x = torch.randn(2, 10, 5)
>>> # Batch: Simple option
>>> # Batch: different lengthscale for each batch
>>> covar = covar_module(x)  # Output: LazyTensor of size (2 x 60 x 60)

## Kernels for Scalable GP Regression Methods¶

### GridKernel¶

class gpytorch.kernels.GridKernel(base_kernel: gpytorch.kernels.kernel.Kernel, grid: torch.Tensor, interpolation_mode: Optional[bool] = False, active_dims: Optional[bool] = None)[source]

If the input data $$X$$ are regularly spaced on a grid, then GridKernel can dramatically speed up computatations for stationary kernel.

GridKernel exploits Toeplitz and Kronecker structure within the covariance matrix. See Fast kernel learning for multidimensional pattern extrapolation for more info.

Note

GridKernel can only wrap stationary kernels (such as RBF, Matern, Periodic, Spectral Mixture, etc.)

Parameters: base_kernel (Kernel) – The kernel to speed up with grid methods. grid (Tensor) – A g x d tensor where column i consists of the projections of the grid in dimension i. active_dims (tuple of ints, optional) – Passed down to the base_kernel. interpolation_mode (bool) – Used for GridInterpolationKernel where we want the covariance between points in the projections of the grid of each dimension. We do this by treating grid as d batches of g x 1 tensors by calling base_kernel(grid, grid) with last_dim_is_batch to get a d x g x g Tensor which we Kronecker product to get a g x g KroneckerProductLazyTensor.
register_buffer_list(base_name, tensors)[source]

Helper to register several buffers at once under a single base name

update_grid(grid)[source]

Supply a new grid if it ever changes.

### GridInterpolationKernel¶

class gpytorch.kernels.GridInterpolationKernel(base_kernel: gpytorch.kernels.kernel.Kernel, grid_size: Union[int, List[int]], num_dims: Optional[int] = None, grid_bounds: Optional[Tuple[float, float]] = None, active_dims: Optional[Tuple[int, ...]] = None)[source]

Implements the KISS-GP (or SKI) approximation for a given kernel. It was proposed in Kernel Interpolation for Scalable Structured Gaussian Processes, and offers extremely fast and accurate Kernel approximations for large datasets.

Given a base kernel k, the covariance $$k(\mathbf{x_1}, \mathbf{x_2})$$ is approximated by using a grid of regularly spaced inducing points:

$\begin{equation*} k(\mathbf{x_1}, \mathbf{x_2}) = \mathbf{w_{x_1}}^\top K_{U,U} \mathbf{w_{x_2}} \end{equation*}$

where

• $$U$$ is the set of gridded inducing points
• $$K_{U,U}$$ is the kernel matrix between the inducing points
• $$\mathbf{w_{x_1}}$$ and $$\mathbf{w_{x_2}}$$ are sparse vectors based on $$\mathbf{x_1}$$ and $$\mathbf{x_2}$$ that apply cubic interpolation.

The user should supply the size of the grid (using the grid_size attribute). To choose a reasonable grid value, we highly recommend using the gpytorch.utils.grid.choose_grid_size() helper function. The bounds of the grid will automatically be determined by data.

(Alternatively, you can hard-code bounds using the grid_bounds, which will speed up this kernel’s computations.)

Note

GridInterpolationKernel can only wrap stationary kernels (such as RBF, Matern, Periodic, Spectral Mixture, etc.)

Parameters: base_kernel (Kernel) – The kernel to approximate with KISS-GP grid_size (Union[int, List[int]]) – The size of the grid in each dimension. If a single int is provided, then every dimension will have the same grid size. num_dims (int) – The dimension of the input data. Required if grid_bounds=None grid_bounds (tuple(float, float), optional) – The bounds of the grid, if known (high performance mode). The length of the tuple must match the number of dimensions. The entries represent the min/max values for each dimension. active_dims (tuple of ints, optional) – Passed down to the base_kernel.

### InducingPointKernel¶

class gpytorch.kernels.InducingPointKernel(base_kernel: gpytorch.kernels.kernel.Kernel, inducing_points: torch.Tensor, likelihood: gpytorch.likelihoods.likelihood.Likelihood, active_dims: Optional[Tuple[int, ...]] = None)[source]

### RFFKernel¶

class gpytorch.kernels.RFFKernel(num_samples: int, num_dims: Optional[int] = None, **kwargs)[source]

Computes a covariance matrix based on Random Fourier Features with the RBFKernel.

Random Fourier features was originally proposed in ‘Random Features for Large-Scale Kernel Machines’ by Rahimi and Recht (2008). Instead of the shifted cosine features from Rahimi and Recht (2008), we use the sine and cosine features which is a lower-variance estimator — see ‘On the Error of Random Fourier Features’ by Sutherland and Schneider (2015).

By Bochner’s theorem, any continuous kernel $$k$$ is positive definite if and only if it is the Fourier transform of a non-negative measure $$p(\omega)$$, i.e.

$$$k(x, x') = k(x - x') = \int p(\omega) e^{i(\omega^\top (x - x'))} d\omega.$$$

where $$p(\omega)$$ is a normalized probability measure if $$k(0)=1$$.

For the RBF kernel,

$$$k(\Delta) = \exp{(-\frac{\Delta^2}{2\sigma^2})} and p(\omega) = \exp{(-\frac{\sigma^2\omega^2}{2})}$$$

where $$\Delta = x - x'$$.

Given datapoint $$x\in \mathbb{R}^d$$, we can construct its random Fourier features $$z(x) \in \mathbb{R}^{2D}$$ by

$\begin{split}$$z(x) = \sqrt{\frac{1}{D}} \begin{bmatrix} \cos(\omega_1^\top x)\\ \sin(\omega_1^\top x)\\ \cdots \\ \cos(\omega_D^\top x)\\ \sin(\omega_D^\top x) \end{bmatrix}, \omega_1, \ldots, \omega_D \sim p(\omega)$$\end{split}$

such that we have an unbiased Monte Carlo estimator

$$$k(x, x') = k(x - x') \approx z(x)^\top z(x') = \frac{1}{D}\sum_{i=1}^D \cos(\omega_i^\top (x - x')).$$$

Note

When this kernel is used in batch mode, the random frequencies are drawn independently across the batch dimension as well by default.

Parameters: num_samples (int) – Number of random frequencies to draw. This is $$D$$ in the above papers. This will produce $$D$$ sine features and $$D$$ cosine features for a total of $$2D$$ random Fourier features. num_dims (int, optional) – (Default None.) Dimensionality of the data space. This is $$d$$ in the above papers. Note that if you want an independent lengthscale for each dimension, set ard_num_dims equal to num_dims. If unspecified, it will be inferred the first time forward is called. randn_weights (torch.Tensor) – The random frequencies that are drawn once and then fixed.

Example

>>> # This will infer num_dims automatically
>>> kernel= gpytorch.kernels.RFFKernel(num_samples=5)
>>> x = torch.randn(10, 3)
>>> kxx = kernel(x, x).evaluate()
>>> print(kxx.randn_weights.size())
torch.Size([3, 5])


text:
### ofi's blog

By ofi, history, 8 months ago, ,
vector<int> v;

int f()
{
v.push_back(-1);
return 1;
}
int main()
{
v.push_back(0);
cout<<v[0]<<endl;
v[0]=f();
cout<<v[0]<<' '<<v[1]<<endl;

return 0;
}

expected output:

0

1 -1

output:

0

0 1

•
• +49
•

 » 8 months ago, # |   +51 When evaluating v[0]=f(); vector resizes from 1 to 2, reallocation happens, but the left-hand side address is evaluated before reallocation happens, so you perform an assignment to the memory region that is not a content of a vector any more. The order of evaluation of sides in an assignment operator is not defined, thus you have UB.
•  » » 8 months ago, # ^ |   0 This paper "Refining Expression Evaluation Order for Idiomatic C++" was proposed for the C++17 standard. Pretty sure that it also did get accepted, so it shouldn't be UB anymore. Though I didn't find any proof other than g++ -std=c++17 doing the expected thing.Btw, pretty funny that you are allowed to write C++ proposals in Word...
•  » » » 8 months ago, # ^ |   +3 To get proof open the latest working draft based on c++17 branch n4659 and check if the changes from proposal are there. [Cppreference]http://en.cppreference.com/w/cpp/language/eval_order) is also a good source.
•  » » » » 8 months ago, # ^ |   0 Yeah, should have checked it yesterday, but I was too tired.Just for reference, the C++17 draft says: "The right operand is sequenced before the left operand." (under 8.18 Assignment and compound assignment operators)
•  » » » 8 months ago, # ^ | ← Rev. 2 →   +8 Personally, I see no harm if it is written in Word, as long as the idea is clearly expressed :)
 » 8 months ago, # | ← Rev. 2 →   0 The following modification produces the expected output. int w = f(); v[0] = w; Global variables should be used carefully so as to avoid such unexpected side effects. Best wishes
 » 8 months ago, # |   +8 Thanks, it really was usefull.


text:
# Homework Help: Standard Deviation question

1. Jan 8, 2006

### Pepsi

Umm its tough to see so I'll write the question too...
The standard deviation of the annual growth rates of a mutual fund is an indicator of how volitile or risky the fund is. Determine the upper and lower limits of the annual growth rate for each fund, such that there is a 0.75 probability that the actual annual growth rate falls symmetrically about the mean within those limits, as showin in the diagram below.
(The Zscale from left to right starting at the bottom is, -x. mean, x)
Its end of the year practice so I forget a bit of things, but in the previous question I was to find the Mean and Standard deviation for the data provided for two seperate funds. Now I'm just a bit stuck as to how I should go about this... Here's what I tryed
I'll just do for one fund right now cause once I figure out this one I can get the second easy.
Okay I take the mean collected in the first question, which is 4.2, and I simply make -x 3.5 (SD of .7) and x 4.9. Giving me the Lower and Upper bounds? I am so stuck if someone could lend a hand and work this out WITH ME that would be super.

Last edited: Jan 8, 2006
2. Jan 9, 2006

### EnumaElish

You have a mean and a standard deviation. So you know what the "bell curve" looks like because you know its location and spread. What you need to solve for is x, such that Prob(-x < r < x) = 0.75. If you standardize your variable r, you will have z = (r - μ)/σ. Then you can write Prob(-c < z < c) = 0.75, where c = (x - μ)/σ.

c is the multiple of your standard deviation that symmetrically bounds the growth rate with a probability of 0.75; it is the parameter you need to solve for.


text:
# Import queue

+ 5 like - 0 dislike
14266 views

Request questions from sites on the StackExchange networks that are on-topic here too, to be imported here. Moderators may then import the question.

This thread can not only be used to request importing single questions, but PhysicsOverflow members who like some or all of their (for PhysicsOverflow on topic) SE posts imported can say so in a corresponding answer here too. Any other specific list of questions is fine too.

edited Feb 5, 2015

I will mention some questions we listed here too, if I am at a second look not 100% certain about importing them and interpret the upvotes as agreement with getting them.

I mean all of those questions should have been ok on Physics SE, but I am sometimes not sure if other people think they are a good fit for PhysicsOverflow too.

I have recategorised this under "Public Official Threads" so users can request their posts to be imported as per your addendum.

To keep this page from growing to infinity,should we delete the questions regarding those that actually got imported?

@RonMaimon I agree, but hide, not delete (delete erases from the database itself).

@Dilaton On SE, answers can be ordered by time if one needs to, but not here.

I meant it moved to a random position in the questions list, it wasn't bumped anymore.

@RonMaimon hiding is ok But concerning references and study material (concerning advanced topics) they newer cluttered any site on SE (not the ones I was interested in) so they will not here either. They were considered legitimate in TP.SE and they are not forbidden on MathOverflow. So please dont introduce this for (advanced) students and people who want to learn about a new topic obstructive SE point of view (in SE they always said you can ask in chat which means forget about it because there are no physics people in chat)

ok, but the point is that it shouldn't come with rep, and it's extremely easy to do, and it only needs to be done once in each topic, so perhaps when reviews are up, it can be done in reviews. You can ask the same question on each topic, I think it's best to make a literature review for each tag on reviews, so that each topic has a set of references people can add to. It's just not effort to find literature.

+ 1 like - 0 dislike
answered Mar 28 by (40 points)
edited Mar 29 by Dilaton
+ 0 like - 0 dislike
answered May 16, 2017 by (0 points)

We cannot import an answer without the question. Your answer is in fact not a complete answer to the question on SE, since you don't talk about the necessary reinterpretation of the notion of superposition (which now also becomes an integral).

+ 0 like - 0 dislike
answered Sep 27, 2017 by Motion Mountain

As PhysicsOverflow is for graduate-level discussion, this does not fit our scope.

+ 0 like - 1 dislike
answered Aug 8, 2014 by (0 points)

The only potentially grad-level post is

http://physics.stackexchange.com/questions/112598/how-does-one-produce-entanglement/

depending what answer it will get here, the existing answers are all on standard undergrad-textbook level. I'd like to know if there are experimental methods beyond the textbook method, and what are the merits.

I agree with @JiaYiyang. The how-to-produce-entanglement  question could maybe be seen as on-topic, if taken as an experimental question (?).

+ 0 like - 1 dislike

There are some questions posted by this user on Physics.SE. If they are ok for Physicsoverflow then please import them. I am afraid that some of his questions might get deleted soon there, so I've saved them at archive.org and can be seen in the following links even if they get deleted on Phys.Se,

• Gravitational shifts of frequency in general relativity and classical physics

• Synchrotron radiation and special relativity

• Unknown magnetic moment of orthohydrogen
• A proof for Newtonian origin of residual perihelion advances in solar system
• Emission and absorption of photons by electrons

I've no problem if these question are off-topic on PhysicsOverflow, perhaps being not upto the level of this site.

P.S: Any edits are welcome.

answered Jan 11, 2015 by (15 points)
edited Jan 12, 2015
Unfortunately, none of the questions look graduate-level to me, but if the import suggestion gets enough consensus, I'll import it.

I agree with this assessment but was wondering, if we could import them to chat to save them? Or maybe we could have a chat subcategory chat/PhysicsUnderflow to back up not PO on-topic but worth of salvaging SE questions that could for example be used for a future PhysicsUnderflow?

@Dilaton I think Chat shouldn't be for completely off-topic stuff, only for non-question discussions, tangential discussions moved from other posts, and other open-ended discussions if the author wants them to be there.

I've no problem if the question are off topic here. This question is about general relativity, may be it is on topic here.

+ 0 like - 2 dislike
answered Feb 17 by (0 points)

 Please use answers only to (at least partly) answer questions. To comment, discuss, or ask for clarification, leave a comment instead. To mask links under text, please type your text, highlight it, and click the "link" button. You can then enter your link URL. Please consult the FAQ for as to how to format your post. This is the answer box; if you want to write a comment instead, please use the 'add comment' button. Live preview (may slow down editor)   Preview Your name to display (optional): Email me at this address if my answer is selected or commented on: Privacy: Your email address will only be used for sending these notifications. Anti-spam verification: If you are a human please identify the position of the character covered by the symbol $\varnothing$ in the following word:p$\varnothing$ysicsOverflowThen drag the red bullet below over the corresponding character of our banner. When you drop it there, the bullet changes to green (on slow internet connections after a few seconds). To avoid this verification in future, please log in or register.