text:
# How to: Resolve ambiguous times

An ambiguous time is a time that maps to more than one Coordinated Universal Time (UTC). It occurs when the clock time is adjusted back in time, such as during the transition from a time zone's daylight saving time to its standard time. When handling an ambiguous time, you can do one of the following:

• Make an assumption about how the time maps to UTC. For example, you can assume that an ambiguous time is always expressed in the time zone's standard time.

• If the ambiguous time is an item of data entered by the user, you can leave it to the user to resolve the ambiguity.

This topic shows how to resolve an ambiguous time by assuming that it represents the time zone's standard time.

### To map an ambiguous time to a time zone's standard time

1. Call the IsAmbiguousTime method to determine whether the time is ambiguous.

2. If the time is ambiguous, subtract the time from the TimeSpan object returned by the time zone's BaseUtcOffset property.

3. Call the static (Shared in Visual Basic .NET) SpecifyKind method to set the UTC date and time value's Kind property to DateTimeKind.Utc.

## Example

The following example illustrates how to convert an ambiguous time to UTC by assuming that it represents the local time zone's standard time.

private DateTime ResolveAmbiguousTime(DateTime ambiguousTime)
{
// Time is not ambiguous
if (! TimeZoneInfo.Local.IsAmbiguousTime(ambiguousTime))
{
return ambiguousTime;
}
// Time is ambiguous
else
{
DateTime utcTime = DateTime.SpecifyKind(ambiguousTime - TimeZoneInfo.Local.BaseUtcOffset,
DateTimeKind.Utc);
Console.WriteLine("{0} local time corresponds to {1} {2}.",
ambiguousTime, utcTime, utcTime.Kind.ToString());
return utcTime;
}
}

Private Function ResolveAmbiguousTime(ambiguousTime As Date) As Date
' Time is not ambiguous
If Not TimeZoneInfo.Local.IsAmbiguousTime(ambiguousTime) Then
Return TimeZoneInfo.ConvertTimeToUtc(ambiguousTime)
' Time is ambiguous
Else
Dim utcTime As Date = DateTime.SpecifyKind(ambiguousTime - TimeZoneInfo.Local.BaseUtcOffset, DateTimeKind.Utc)
Console.WriteLine("{0} local time corresponds to {1} {2}.", ambiguousTime, utcTime, utcTime.Kind.ToString())
Return utcTime
End If
End Function

The example consists of a method named ResolveAmbiguousTime that determines whether the DateTime value passed to it is ambiguous. If the value is ambiguous, the method returns a DateTime value that represents the corresponding UTC time. The method handles this conversion by subtracting the value of the local time zone's BaseUtcOffset property from the local time.

Ordinarily, an ambiguous time is handled by calling the GetAmbiguousTimeOffsets method to retrieve an array of TimeSpan objects that contain the ambiguous time's possible UTC offsets. However, this example makes the arbitrary assumption that an ambiguous time should always be mapped to the time zone's standard time. The BaseUtcOffset property returns the offset between UTC and a time zone's standard time.

In this example, all references to the local time zone are made through the TimeZoneInfo.Local property; the local time zone is never assigned to an object variable. This is a recommended practice because a call to the TimeZoneInfo.ClearCachedData method invalidates any objects that the local time zone is assigned to.

## Compiling the code

This example requires:

• That the System namespace be imported with the using statement (required in C# code).

format: plain


text:
# Can TikZ rounded corners make a bulging curvy triangle?

I would like to draw a smoothly rounded figure in TikZ as below, but with simpler (and easier to modify) code. I mean without hand calculating good tangents for the curve at all vertices. That would make it easier to do less symmetric triangles, and other polygons.

Note that unlike the question

Drawing a triangle with rounded corners in TikZ

I want the outline to curve in and out to make bulges.

I wonder if the rounded corners option will let me do this by drawing a hexagon with alternate vertices closer and farther from the center. My attempts so far have failed, for reasons that the TikZ and PGF Manual describes on p. 587. Even when I make the curve of the corners very small the lines ''suddenly extend over the other end" which looks terrible. This may just be more than the option can be expected to do.

But is there a way to do it?

\documentclass{amsart}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,3.5)
to [out=0,in=120]  (1.5,2.7)
to [out=-60,in=50] (3,0)
to [out=-130,in=0] (0,.05)
to [out=180,in=-50] (-3,0)
to [out=130,in=-120] (-1.5,2.7)
to [out=60,in=180] (0,3.5);
\end{tikzpicture}
\end{document}

• Could you add an image detailing your problem? I'm sort of at a loss what exactly your problem is.
– Timm
Mar 8, 2017 at 16:26
• Edit your question and than click on the "add image" icon you'll find near the {} icon. Then click up the popup to upload the image from your machine. Mar 8, 2017 at 16:49
• @CarLaTeX Thanks, I had only tried to drag and drop, which did not work for me. Mar 8, 2017 at 16:52

A simple way (same idea as here: Tikz Macro with list of arguments and subroutine calculation)

\documentclass{amsart}
\usepackage{tikz}

\begin{document}

\tikzset{
bulging/.style 2 args={
every to/.style={bend left=#1},
preaction={
fill,draw,join=round,line width=#2+1},
white,fill,draw,join=round,line width=#2,
},
}

\tikz\draw[bulging={20}{60}](0,0)to(3,0)to(2,2)to cycle;
%
\hfill
%
\tikz\draw[bulging={40}{50}](0,0)to(3,0)to(4,2)to(2,5)to(-1,3)tocycle;

\vfill

\tikz\draw[bulging={50}{50}](0,0)to(4,0)to(6,2)to(7,4)to(5,8)to(1,8)to(-1,5)tocycle;

\end{document}

• This works nicely. But one disadvantage is that it will not scale correctly when you use a format like \tikz\draw[scale=.5,bulging={40}{50}] Mar 9, 2017 at 21:42
• It also does not work with styles like pattern=north west lines or dashed. Aug 17, 2017 at 14:25


text:
• Not logged in

# Embedding GraphViz in LaTeX documents

I have to say I'm loving using LaTeX for my Uni papers. It is so delightfully straightforward and powerful.

I am embedding some GraphViz diagrams in my documents, but I didn't want a round trip to a different editor buffer and the shell to edit/compile/insert the diagram.

Based on graphviz.tex code by Derek Rayside I have created a custom LaTeX function that will automatically compile and embed inline GraphViz code (man those wacky capitilisations are getting boring!)

You embed a graph like so:

   \digraph[scale=0.5]{MyGraph}{rankdir=LR; a->b; b->c}
Be careful not to have any double newlines or your dot file will have some bogus \par comments in it (which I should replace with newlines in the function...). Another possible enhancement would be to add a dynamic dot command to set the maximum diagram height & width to the current page/column dimensions.

You need my graphviz.sty and you need the following in your document preamble:

   \usepackage[pdftex]{graphicx}
\usepackage{graphviz}

Remember to run texhash if you install the style in a system-wide location. Note this assumes pdflatex. Modifying the command for regular latex is an exercise left for the reader. Update: Derek now has an updated version available on GitHub (which didn't exist in 2007 :). https://github.com/drayside/graphviz.sty/blob/master/graphviz.sty.

08:09 AM, 25 Mar 2007 by Mark Aufflick Permalink

### Todo

Change this style to use the excellent dot2tex: http://www.fauskes.net/nb/introducing-dot2tex/

by Mark Aufflick on 05/21/07

### cool

Awesome! This was very useful for me.

by Unregistered Visitor on 02/13/09

### Thank you

I really like this, and I fiddled around with dot2tex as suggested in your comment to yourself. Here are my results. I've never written a latex sty file before, so please feel free to improve it.

% graphviz.sty
% by Mark Aufflick
% 2006-03-25
% mark@aufflick.com
% http://mark.aufflick.com/
%
% based on graphviz.tex by Derek Rayside 2003

% \usepackage[pdftex]{graphicx}
% \usepackage{graphviz}

% parameters to \digraph:
% 1 - parameters for \includegraphics (optional; default value is "scale=1")
% 2 - name of the digraph
% 3 - body of the digraph

% assumes pdflatex. to modify this command for regular latex,
% replace all .pdf with .ps, and the command becomes simply:
% dot -Tps #1.dot

\ProvidesPackage{dottotex}

\newcommand{\dottotex}[2]{
\newwrite\dotfile
\immediate\openout\dotfile=#1.dot
\immediate\write\dotfile{digraph #1 {\string#2}}
\immediate\closeout\dotfile
\write18{bash -c "which neato -Txdot #1.dot | which dot2tex -tmath --figonly --usepdflatex -ftikz --tikzedgelabels --styleonly -o #1tikz.tex"}
\IfFileExists{#1tikz.tex}
% the tex exists: include it
{ \include{#1tikz} }
% the tex was not created - show a hint
{ \fbox{ \begin{tabular}{l}
The file \texttt{#1tikz.tex} hasn't been created from
\texttt{#1.dot} yet. \\
We attempted to create it with:\\
\texttt{neato -Txdot #1.dot | dot2tex  --figonly --usepdflatex -ftikz --tikzedgelabels --styleonly -o #1tikz.tex} \\
but that seems not to have worked. You need to execute \texttt{pdflatex} with \\
the \texttt{-shell-escape} option.
\end{tabular}}
}
}

by Unregistered Visitor on 04/02/09

### Something to be wary of

by Unregistered Visitor on 10/06/10

### Updated version on Github

For an updated version of GraphViz.sty see Mike Prentice's Github version: https://github.com/mprentice/GraphViz-sty

by Mark Aufflick on 02/23/11

### Filenames with hyphens

If you want filenames with hyphens in them, put quotes around #2 in the following line: \immediate\write\dotfile{digraph #2 {\string#3}}

by Unregistered Visitor on 04/02/13

### Accents and labels with spaces

Very nice functionality! But how do you prevent PDFLaTeX from introducing strange codes when using spaces and accented characters in, e.g. label? Example: try the following \digraph[scale=0.5]{MyGraph}{rankdir=LR; a [label="This is A"]; a->b; b->c} If I drop the double quotes there will be three nodes instead of one, and any replacement of the quotes by single quotes or braces, will result in strange nodes labeled with LaTeX items from when it processes the box; just like when the label string contains accented characters. Solving this would, for my use, make graphviz.sty full featured. Best regards, Morten Lind.

by Unregistered Visitor on 06/27/13

### Updated version on Github

I just uploaded a newer version of this to Github: https://github.com/drayside/graphviz.sty cheers, Derek.

by Unregistered Visitor on 08/15/13


text:
# P[limsup] of independent events

1. Aug 14, 2009

### student12s

1. The problem statement, all variables and given/known data

Let (A_n) be a sequence of independent events such that Pr(A_n)<1 for all n. Show that P[limsup A_n]=1 if and only if P(\cup_{n=1}^{+\infty} A_n)=1

2. Relevant equations

3. The attempt at a solution
Suppose P[\limsup A_n]=1. Define $B_k=\cup_{i=k}^{+\infty} A_i so that B_n\downarrow \limsup_{n\to+\infty} A_n. Thus \lim_{n\to+\infty} P(B_n)=P(\limsup_{n\to+\infty} A_n)=1. So, for all \epsilon>0, there is M so that 1\geq P(\cup_{i=1}^{+\infty} A_i)\geq P(\cup_{i=M}^{+\infty}A_i)\geq 1-\epsilon$, so P(\cup_{i=1}^{+\infty} A_i)=1.
I am having trouble with the other direction. Any hints?


text:
# Nanometrology: Absolute Seebeck coefficient of individual silver nanowires

## Abstract

Thermoelectric phenomena can be strongly modified in nanomaterials. The determination of the absolute Seebeck coefficient is a major challenge for metrology with respect to micro- and nanostructures due to the fact that the transport properties of the bulk material are no more valid. Here, we demonstrate a method to determine the absolute Seebeck coefficient S of individual metallic nanowires. For highly pure and single crystalline silver nanowires, we show the influence of nanopatterning on S in the temperature range between 16 K and 300 K. At room temperature, a nanowire diameter below 200 nm suppresses S by 50% compared to the bulk material to less than S = 1 μVK−1, which is attributed to the reduced electron mean free path. The temperature dependence of the absolute Seebeck coefficient depends on size effects. Thermodiffusion and phonon drag are reduced with respect to the bulk material and the ratio of electron-phonon to phonon-phonon interaction is significantly increased.

## Introduction

Bulk silver has the highest electrical and thermal conductivity of all metals1 and well-known thermoelectric properties2,3,4,5,6. For this reason, it is a widely used material in the electronics industry. In recent years, there has been a great interest in micro- and nanostructures of silver, which are suitable for touch screens, solar cells and batteries7,8,9. A small absolute Seebeck coefficient is important for interconnects in low-noise electronics. While the thermoelectric properties of metallic thin films have been studied5,10,11,12,13,14,15,16, it is very challenging to determine these of individual metallic nanowires17,18,19,20,21.

In general, the thermovoltage is sensitive to structural defects, metal grain structure and surface passivation, e.g. for polycrystalline silver nanowires, the transport properties are therefore reduced compared to the bulk material18. Individual single crystalline silver nanowires are well suited to study size effects19.

However, the absolute Seebeck coefficient of individual silver nanowires remains an open issue. In particular, the determination of the absolute Seebeck coefficient of an individual metallic nanowire requires the knowledge of the absolute Seebeck coefficient of the micro- and nanopatterned thermoelectric reference material. For such, it has been shown that the Seebeck coefficient is size-dependent10,11,12.

Here, high-purity and single crystalline nanowires serve as a model system to investigate the influence of nanopatterning on the absolute Seebeck coefficient S. The examined silver nanowires show no change of the crystal structure, the electron density and the Debye temperature compared to bulk silver19. The essential difference between the silver nanowires and bulk silver is that the electron mean free path is comparable to the diameter of the nanowires19.

Thermodiffusion and phonon drag are the two main contributions to the absolute Seebeck coefficient11,12,22. The thermodiffusion of charge carriers in the material caused by a temperature difference can be described by Mott’s formula11,12,22,23. The phonon drag arises from the interaction between electrons and phonons11,12,22,24.

Here, we demonstrate a high precision method to measure ultra-low absolute Seebeck coefficients of individual metallic nanowires. We present a model for the temperature dependence of S and discuss the influence of electron-phonon and phonon-phonon interaction on the absolute Seebeck coefficient of silver nanowires and bulk silver. The thermoelectric properties correlate with size effects and lead to the vanishing behavior of the absolute Seebeck coefficient of the silver nanowires.

## Results

### Structural properties

The crystallinity of the individual silver nanowires was confirmed by transmission electron microscopy. Figure 1a shows a silver nanowire placed on a lacey carbon film. The growth direction is along [110]. Selected area electron diffraction analysis and high-resolution transmission electron microscopy confirm the face centered cubic structure as given in Fig. 1b,c, respectively. The structural and chemical properties were discussed in detail previously19.

### Electrical properties

A thermoelectric nanowire characterization platform (TNCP)19,25,26 was used in order to determine the electrical conductivity and the Seebeck coefficient of the silver nanowires. Electron beam-induced deposition contacts were prepared to improve the electrical and mechanical connection between the nanowire and the measurement platform. A scanning electron microscopy image of a silver nanowire (NW 3) on top of the platinum conduction lines of the TNCP is depicted in Fig. 1d. A schematic of the measurement setup is given in Fig. 1e. For extensive descriptions of the TNCP and length scales, see Kojda et al.19,20,25 Geometry parameters determined by scanning and transmission electron microscopy and as well as the electrical conductivity σ determined from four-terminal resistance measurements at room temperature are given in Table 1. The electrical conductivity of the silver nanowires is reduced compared to the bulk material, see Fig. 2a. This can be attributed to size effects, which reduce the electron mean free path in the silver nanowires as shown in Fig. 2b. The results of the electrical measurements are in agreement with Kojda et al.19.

### Relative Seebeck coefficient

The temperature-dependent Seebeck coefficient $${S}_{{\rm{Ag}},{\rm{Pt}}}$$ of individual silver nanowires relative to 200 nm thick platinum conduction lines was measured between bath temperatures of 16 K and room temperature. The thermovoltage $${U}_{{\rm{S}} \mbox{-} {\rm{Ag}},{\rm{Pt}}}$$ as a function of the micro heater current $${I}_{{\rm{H}}}$$ is presented for a selection of bath temperatures in Fig. 3a. Its parabolic behavior confirms the presence of the thermoelectric effect. Figure 3b shows the thermovoltage as a function of the temperature difference. The temperature difference $$\delta T$$ between the hot and the cold side of the silver nanowires was calculated by the change of four-terminal-resistance thermometers due to the variation of the power of the micro heater. The slope of the function $${U}_{{\rm{S}} \mbox{-} {\rm{Ag}},{\rm{Pt}}}(\delta T)$$ gives the Seebeck coefficient $${S}_{{\rm{Ag}},{\rm{Pt}}}$$ of the silver nanowires with respect to the platinum conduction lines

$${S}_{{\rm{Ag}},{\rm{Pt}}}={S}_{{\rm{Ag}}}-{S}_{{\rm{Pt}}}=-\,\frac{{\rm{d}}{U}_{{\rm{S}} \mbox{-} {\rm{Ag}},{\rm{Pt}}}}{{\rm{d}}\delta T}\mathrm{}.$$
(1)

The temperature dependence of the relative Seebeck coefficient, Fig. 4c, agrees well for different individual silver nanowires. $${S}_{{\rm{Ag}},{\rm{Pt}}}$$ is decreasing with decreasing bath temperature, a sign reversal occurs at 150 K. Below 50 K, the relative Seebeck coefficient tends to zero with decreasing bath temperature.

### Absolute Seebeck coefficient

In order to obtain the absolute Seebeck coefficient of a silver nanowire, which is given by

$${S}_{{\rm{Ag}}}={S}_{{\rm{Ag}},{\rm{Pt}}}+{S}_{{\rm{Pt}}},$$
(2)

the absolute Seebeck coefficient of the platinum conduction line $${S}_{{\rm{Pt}}}$$ is required. $${S}_{{\rm{Pt}}}$$ was determined in a separate experiment10 by measuring a bulk gold wire with known absolute Seebeck coefficient relative to the thin platinum conduction line. See also Supplementary Information S3. A detailed discussion of the absolute Seebeck coefficient of thin platinum films and the effects of heat treatment on the transport properties is given in reference10. The relative and absolute Seebeck coefficients of the reference platinum film are given in Fig. 4a,b.

The relative and absolute Seebeck coefficients of the silver nanowires versus bath temperature are given in Fig. 4c,d, respectively. The reference value of the absolute Seebeck coefficient of bulk silver3,6 is plotted as a blue line in Fig. 4d. The gray shaded area around the blue line defines the uncertainty of the Seebeck coefficient due to several data given in the literature2,3,4,6.

Our results show that the absolute Seebeck coefficient of the silver nanowires is reduced compared to the bulk material and exhibits only a weak temperature dependence in the temperature range from 200 K up to 300 K. In this regime, the absolute Seebeck coefficient of bulk silver exhibits a linear temperature dependence. In the temperature range from 200 K down to 100 K, the absolute Seebeck coefficient of the silver nanowires is increasing with decreasing bath temperature and reaches the maximum at 88 K. From 150 K down to 100 K the Seebeck coefficient of the silver nanowires is larger than the corresponding bulk Seebeck coefficient. The maximum Seebeck coefficient of bulk silver can be observed at 35 K. The phonon drag peak of the silver nanowires is shifted towards higher bath temperatures compared to the bulk material. The absolute Seebeck coefficient of the silver nanowires and of bulk silver tend to zero with decreasing bath temperature after reaching their maximum value.

## Discussion

The electron mean free path $${\Lambda }_{{\rm{el}}}$$ was determined from the change of the electrical conductivity of the nanowire compared to the bulk material. Under the assumption that scattering events reduce the mean free path, it can be described and related to Matthiessen rule10,19.

$${\Lambda }_{{\rm{el}},{\rm{nw}}}{(T)}^{-1}={\Lambda }_{{\rm{el}},{\rm{b}}}{(T)}^{-1}+{\Lambda }_{{\rm{el}},{\rm{s}}}^{-1}$$
(3)

is the inverse nanowire electron mean free path, $${\Lambda }_{{\rm{el}},{\rm{b}}}{(T)}^{-1}$$ is the inverse mean free path of the bulk material and $${\Lambda }_{{\rm{el}},{\rm{s}}}^{-1}$$ is the inverse temperature-independent scattering length of the electrons due to surface scattering.

$${\Lambda }_{{\rm{el}},{\rm{nw}}}(T)=\frac{{\sigma }_{{\rm{nw}}}(T)}{{\sigma }_{{\rm{nw}}}({\rm{RT}})}{\Lambda }_{{\rm{el}},{\rm{nw}}}({\rm{RT}})$$
(4)

and

$${\Lambda }_{{\rm{el}},{\rm{b}}}(T)=\frac{{\sigma }_{{\rm{b}}}(T)}{{\sigma }_{{\rm{b}}}({\rm{RT}})}{\Lambda }_{{\rm{el}},{\rm{b}}}({\rm{RT}})$$
(5)

are the electron mean free paths of the nanowire and of the bulk material, respectively. For bulk silver, a value of $${\Lambda }_{{\rm{el}},{\rm{b}}}({\rm{RT}})=53\,{\rm{nm}}$$ is reported at room temperature27.

For a nanowire, the electron mean free path was determined from the measured electrical resistance (electrical conductivity) in the temperature range from room temperature down to $$T=140\,{\rm{K}}$$. For $$T\le 130\,{\rm{K}}$$, the electron mean free path was calculated from the extrapolated electrical resistance (electrical conductivity) that has been determined by the Bloch-Grüneisen formula. Figure 2b shows the electron mean free path (NW 3) as a function of the bath temperature, it is in the order of the nanowire diameter. Therefore, the enhanced surface scattering leads to a reduced electrical conductivity of the silver nanowires compared to the bulk material19.

The absolute Seebeck coefficient S is the sum of the thermodiffusion $${S}_{{\rm{diff}}}$$ and the phonon drag $${S}_{{\rm{ph}}}$$ contributions11,12,22, $$S={S}_{{\rm{diff}}}+{S}_{{\rm{ph}}}$$. For temperatures higher than the Debye temperature ($$T > {\Theta }_{{\rm{D}}}$$), the absolute Seebeck coefficient is dominated by phonon-phonon scattering events22, which leads to a linear temperature dependence and can be described by Mott’s formula10,11,12,23.

The phonon drag effect is an indicator of the strength of the electron-phonon interaction and has a strong influence on S of metals below the Debye temperature11,12,22. It is connected with the specific heat of the phonons12,22

$${C}_{{\rm{ph}}}(T)=9n{k}_{{\rm{B}}}{(\frac{T}{{\Theta }_{{\rm{D}}}})}^{3}\,{\int }_{0}^{\frac{{\theta }_{{\rm{D}}}}{T}}\,\frac{{x}^{4}\,\exp (x)}{{(\exp (x)-1)}^{2}}{\rm{d}}x$$
(6)

with the number of charge carriers per volume n and $$x=\frac{\hslash {\omega }_{{\rm{D}}}}{{k}_{{\rm{B}}}T}=\frac{{\Theta }_{{\rm{D}}}}{T}$$ that is given by the reduced Planck constant $$\hslash$$, the Debye frequency $${\omega }_{{\rm{D}}}$$ and the Boltzmann constant $${k}_{{\rm{B}}}$$.

The phonon drag contribution to S is given by10,22

$${S}_{{\rm{ph}}}={F}_{{\rm{ph}}}\frac{{C}_{{\rm{ph}}}(T)}{3ne}\gamma ={F}_{{\rm{ph}}}\frac{{C}_{{\rm{ph}}}(T)}{3ne}\frac{{\tau }_{{\rm{pp}}}}{{\tau }_{{\rm{pp}}}+{\tau }_{{\rm{ep}}}}.$$
(7)

Therefore, the phonon-phonon scattering time $${\tau }_{{\rm{pp}}}$$ and the scattering time of the electron-phonon interaction $${\tau }_{{\rm{ep}}}$$ has to be taken into account22. The temperature dependence of the electron-phonon and phonon-phonon interaction can be described by the γ-factor

$$\gamma =\frac{1}{1+\frac{{\tau }_{{\rm{ep}}}}{{\tau }_{{\rm{pp}}}}}=\frac{1}{1+{F}_{\tau }T\,\exp (\,-\,\frac{{\Theta }_{{\rm{D}}}}{T})}\mathrm{}.$$
(8)

The relation $$\frac{{\tau }_{{\rm{ep}}}}{{\tau }_{{\rm{pp}}}}={F}_{\tau }T\,\exp (\,-\,\frac{{\Theta }_{{\rm{D}}}}{T})$$ was adapted from12,28, assuming that the phonon-phonon interaction becomes dominant at high temperatures12,28. Hence, the temperature dependence of the absolute Seebeck coefficient is given by

$$S(T)={F}_{{\rm{diff}}}\frac{T}{{\Theta }_{{\rm{D}}}}+\frac{{F}_{{\rm{ph}}}{(\frac{T}{{\Theta }_{{\rm{D}}}})}^{3}\,{\int }_{0}^{\frac{{\theta }_{{\rm{D}}}}{T}}\,\frac{{x}^{4}\,\exp (x)}{{(\exp (x)-1)}^{2}}{\rm{d}}x}{1+{F}_{\tau }T\,\exp (\,-\frac{{\Theta }_{{\rm{D}}}}{T})}\mathrm{}.$$
(9)

The parameters $${F}_{{\rm{diff}}}$$, $${F}_{{\rm{ph}}}$$ and $${F}_{\tau }$$ include the size effects on behalf of nanopatterning and are discussed below.

The thermodiffusion of charge carriers due to a temperature difference along the silver nanowires is described by the parameter $${F}_{{\rm{diff}}}$$. Applying $$S(T)$$ from Eq. 9 on our measurement data, yields $${F}_{{\rm{diff}},{\rm{NWs}}}=\mathrm{(0.3}\pm \mathrm{0.1)}\,\mu {{\rm{VK}}}^{-1}$$ and $${F}_{{\rm{diff}},{\rm{bulk}}}=\mathrm{(1.0}\pm \mathrm{0.1)}\,\mu {{\rm{VK}}}^{-1}$$. The parameter $${F}_{{\rm{diff}}}$$ of the silver nanowires is reduced compared to the bulk value. This can be attributed to the electron mean free path that is in the order of the nanowire diameter and leads to more surface scattering events compared to the bulk material. Bulk silver exhibits a linear temperature dependence of the Seeebeck coefficient above the Debye temperature ($${\Theta }_{{\rm{D}},{\rm{Ag}},{\rm{bulk}}}=215\,{\rm{K}}$$19), which is not observed for the silver nanowires in the investigated temperature range.

The phonon drag contribution is described by the parameter $${F}_{{\rm{ph}}}$$. The fit parameters of bulk silver $${F}_{{\rm{ph}},{\rm{bulk}}}=\mathrm{(12}\pm \mathrm{2)}\,\mu {{\rm{VK}}}^{-1}$$ and of the silver nanowires $${F}_{{\rm{ph}},{\rm{NWs}}}=\mathrm{(5.2}\pm \mathrm{0.4)}\,\mu {{\rm{VK}}}^{-1}$$ scale the influence of the phonon drag on the Seebeck coefficient. $${F}_{{\rm{ph}},{\rm{NWs}}}$$ is reduced compared to $${F}_{{\rm{ph}},{\rm{bulk}}}$$. The temperature profile of the phonon drag contribution to the Seebeck coefficient of the silver nanowires is broadened compared to the bulk material. Furthermore, a shift of the phonon drag peak towards higher bath temperatures compared to the bulk material is observed. For temperatures $$T > 300\,{\rm{K}}$$, the absolute Seebeck coefficient of the silver nanowires is expected to increase linear with increasing bath temperatures according to thermodiffusion contribution.

The electron-phonon vs. phonon-phonon interaction is as follows. The parameter $${F}_{\tau }$$ $$({F}_{\tau ,{\rm{bulk}}}=\mathrm{(1.2}\pm \mathrm{0.3)}\,{{\rm{K}}}^{-1}$$, $${F}_{\tau ,{\rm{NWs}}}=\mathrm{(0.03}\pm \mathrm{0.01)}\,{{\rm{K}}}^{-1})$$ gives the ratio of the scattering time of the electron-phonon interaction and of the phonon-phonon interaction and determines the γ-factor. $${F}_{\tau ,{\rm{NWs}}}$$ is reduced compared to the bulk material.

Figure 5 shows the γ-factor of the silver nanowires and bulk silver as a function of the temperature. The γ-factor is a number between 0 and 1, which depends on the interaction between phonons and electrons. At low temperatures $$T\ll {\Theta }_{{\rm{D}}}$$, $$\gamma \approx 1$$. This means that the temperature dependence of the phonon drag is determined by the specific heat that results in $${S}_{{\rm{ph}}}\propto {T}^{3}$$. Phonon-phonon interaction is dominant for $$\gamma \approx 0$$. This behavior occurs at temperatures $$T > {\Theta }_{{\rm{D}}}$$, so $${S}_{{\rm{ph}}}\propto \frac{1}{T}$$.

In general, the difference between the γ-factor of the silver nanowires $$({\gamma }_{{\rm{NWs}}})$$ and of the bulk material $$({\gamma }_{{\rm{bulk}}})$$ can be explained by the small diameter of the nanowires and the much larger surface-area-to-volume ratio of the silver nanowires compared to bulk silver.

γNWs is larger than γbulk at room temperature. This can be attributed to a stronger reduction of the thermodiffusion contribution compared to the phonon drag contribution to the absolute Seebeck coefficient of the silver nanowires. For this reason, it can be derived that the electron-phonon interaction has already an influence on the absolute Seebeck coefficient of the silver nanowires at 300 K. Whereas, γbulk is dominated by the phonon-phonon interaction. This is expressed in a significant amount of the thermodiffusion contribution compared to the phonon drag contribution to the absolute Seebeck coefficient of bulk silver.

γNWs and γbulk increase with decreasing temperatures. Below 80 K, the increase of $${\gamma }_{{\rm{NWs}}}$$ is less than the increase of $${\gamma }_{{\rm{bulk}}}$$ because the influence of the phonon drag on the absolute Seebeck coefficient of the silver nanowires is decreasing. In contrast to the silver nanowires, the influence of the phonon drag on the absolute Seebeck coefficient of bulk silver is increasing in this temperature range.

In this study, we demonstrated a method to determine the absolute Seebeck coefficient of individual metallic nanowires. The detailed analysis showed that both the thermodiffusion and phonon drag contributions to the absolute Seebeck coefficient of individual single crystalline silver nanowires are reduced compared to bulk silver. In particular, the thermodiffusion part is reduced more than the phonon drag part. The reason for this reduction can be attributed to size effects like surface scattering, which lead to an electron mean free path that is comparable to the nanowire diameter. The ratio of the electron-phonon to phonon-phonon interaction is larger in the silver nanowires than in the bulk material. As a consequence of the small diameter of the nanowires, a channeling effect may restrict the phonon-phonon interaction perpendicular to the nanowire growth direction. For this reason, the electron-phonon interaction in the silver nanowires is significant at room temperature. In general, silver, gold and copper have a similar absolute Seebeck coefficient at room temperature as well as a similar temperature dependence2. For this reason, the effects of micro- and nanopatterning in these metals should lead to comparable results of the absolute Seebeck coefficient. The possibility of suppressing the absolute Seebeck coefficient by design of nanopatterned metallic interconnects (below $$S=1\,\mu {{\rm{VK}}}^{-1}$$ at room temperature) may become important for low-noise applications.

## Methods

### Synthesis, placement and contacts

Highly pure and single crystalline silver nanowires were synthesized by the reduction of silver nitrate (purity: $$\mathrm{99.9999 \% }$$) with ethylene glycol in presence of copper dichloride dihydrate and polyvinylpyrrolidone as described in19. The nanowire suspension was immersed to a grooved silicon wafer. Individual nanowires were lifted from the wafer and assembled on a thermoelectric nanowire characterization platform (TNCP) by a mechanical transfer method. As shown, the TNCP features the combined full thermoelectric characterization of an individual nanowire that includes the determination of the electrical conductivity, the thermal conductivity, the Seebeck coefficient, the structural properties, the chemical composition and the morphology19. Figure 1e shows a sketch of the TNCP including the micro heater (red), the platinum thermometers $${{\rm{T}}}_{{\rm{c}}}$$ and $${{\rm{T}}}_{{\rm{h}}}$$ (orange) and the platinum conduction lines for the thermovoltage measurements $${{\rm{E}}}_{{\rm{h}}}$$, $${{\rm{E}}}_{{\rm{c}}}$$ (orange). The electrical and mechanical connection between the nanowires and the TNCP was performed by electron beam-induced deposition (EBID) as described in19. One nanowire with contacts made by EBID is shown in the scanning electron microscopy (SEM) image in Fig. 1d.

### Measurement setup

The Seebeck coefficients of four individual silver nanowires were measured relative to the Seebeck coefficient of platinum conduction lines with a thickness of 200 nm in a flow cryostat in the temperature range between 16 K and room temperature in an ambient helium atmosphere. A temperature difference along the nanowires was applied by one of the micro heaters at certain stabilized bath temperatures T. For different heater powers the thermovoltage $${U}_{{\rm{S}} \mbox{-} {\rm{Ag}},{\rm{Pt}}}$$ was measured with respect to the cold side of the nanowires. The temperature difference $$\delta T$$ between the hot side and the cold side of the nanowires was determined by the measured four-terminal resistance change of the calibrated thermometer lines $${{\rm{T}}}_{{\rm{h}}}$$ and $${{\rm{T}}}_{{\rm{c}}}$$. Then, the relative Seebeck coefficient is defined by

$${S}_{{\rm{Ag}},{\rm{Pt}}}=-\,\frac{{\rm{d}}{U}_{{\rm{S}} \mbox{-} {\rm{Ag}},{\rm{Pt}}}}{{\rm{d}}\delta T}\mathrm{}.$$
(10)

In the experiments, the heater power is controlled by a Keithley SourceMeter 2401. The thermometer resistances are determined by four terminal measurements performed by a Keithley 6221 and 2182 A. The thermovoltage is measured by a Keithley 2182 A Nanovoltmeter. The measurement configurations are changed by a Keithley 7001 switch matrix system. The absolute Seebeck coefficient of the platinum conduction line was determined within a separate experiment10.

## References

1. 1.

Wiley, B., Sun, Y. & Xia, Y. Synthesis of silver nanostructures with controlled shapes and properties. Accounts of Chemical Research 40, 1067 (2007).

2. 2.

Cusack, N. & Kendall, P. The absolute scale of thermoelectric power at high temperature. Proceedings of the Physical Society 72, 898 (1958).

3. 3.

Pearson, W. B. Survey of thermoelectric studies of the group I metals at low temperatures carried out at NRL, Ottawa. Soviet Physics - Solid State 3, 1024 (1961).

4. 4.

Lee, C. C. & Schroeder, P. A. Phonon drag thermopower in silver alloys. Philosophical Magazine 25, 1161 (1972).

5. 5.

Rao, V. V. R. N., Mohan, S. & Reddy, P. J. The size effect in the thermoelectric power of silver films. Thin Solid Films 42, 283 (1977).

6. 6.

Smith, D. R. & Fickett, F. R. Low-temperature properties of silver. Journal of Research of the National Institute of Standards and Technology 100, 119 (1995).

7. 7.

Cann, M. et al. High performance transparent multi-touch sensors based on silver nanowires. Materials Today. Communications 7, 42 (2016).

8. 8.

Yang, L. et al. Solution-processed flexible polymer solar cells with silver nanowire electrodes. ACS Appl. Mater. Interfaces 3, 4075 (2011).

9. 9.

Kwak, W.-J. et al. Silver nanowires as catalytic cathodes for stabilizing lithium-oxygen batteries. Journal of Power Sources 311, 49 (2016).

10. 10.

Kockert, M., Mitdank, R., Zykov, A., Kowarik, S. & Fischer, S. F. Absolute Seebeck coefficient of thin platinum films. Journal of Applied Physics 126, 105106 (2019).

11. 11.

Huebener, R. P. Size effect on phonon drag in platinum. Physical Review 140, 490 (1965).

12. 12.

Huebener, R. P. Phonon scattering by lattice vacancies in platinum. Physical Review 146, 490 (1966).

13. 13.

Zhu, X. F. et al. Low-temperature thermopower in nanostructured silver. Applied Physics Letters 75, 136 (1999).

14. 14.

Yu, H.-Y. & Leonard, W. F. Thermoelectric power of thin silver films. Journal of Applied Physics 44, 5324 (1973).

15. 15.

Lin, S. F. & Leonard, W. F. Thermoelectric Power of Thins Gold Films. Journal of Applied Physics 42, 3634 (1971).

16. 16.

Huebener, R. P. Thermoelectric Power of Lattice Vacancies in Gold. Physical Review 135, A 1281 (1964).

17. 17.

Shapira, E., Tsukernik, A. & Selzer, Y. Thermopower measurements on individual 30 nm nickel nanowires. Nanotechnology 18, 485703 (2007).

18. 18.

Cheng, Z., Liu, L., Xu, S., Lu, M. & Wang, X. Temperature dependence of electrical and thermal conduction in single silver nanowires. Scientific Reports 5, 10718 (2015).

19. 19.

Kojda, D. et al. Temperature-dependent thermoelectric properties of individual silver nanowires. Physical Review B 91, 024302 (2015).

20. 20.

Kojda, D. et al. Surface effects on thermoelectric properties of metallic and semiconducting nanowires. Physica Status Solidi A 213, 557 (2016).

21. 21.

Völklein, F., Reith, H., Cornelius, T. W., Rauber, M. & Neumann, R. The experimental investigation of thermal conductivity and the Wiedemann-Franz law for single metallic nanowires. Nanotechnology 20, 325706 (2009).

22. 22.

MacDonald, D. K. C. Thermoelectricity – An introduction to the principles. (Dover Publications, Mineola, New York, 2006).

23. 23.

Cutler, M. & Mott, N. F. Observation of Anderson Localization in an Electron Gas. Physical Review 181, 1336 (1969).

24. 24.

Bailyn, M. The phonon drag component of the thermoelectric power of the alkali metals at low temperatures. Philosophical Magazine 5, 1059 (1960).

25. 25.

Kojda, D. et al. The effect of a distinct diameter variation on the thermoelectric properties of individual Bi0.39Te0.61 nanowires. Semiconductor Science and Technology 29, 124006 (2014).

26. 26.

Wang, Z. et al. Electrical conductivity and Seebeck coefficient measurements of single nanowires by utilizing a microfabricated thermoelectric nanowire characterization platform. IEEE 26th International Conference on Micro Electro Mechanical Systems (MEMS) (IEEE, Pscataway, NJ, 508, 2013).

27. 27.

Stojanovic, N., Maithripala, D. H. S., Berg, J. M. & Holtz, M. Thermal conductivity in metallic nanostructures at high temperature: Electrons, phonons, and the Wiedemann-Franz law. Physical Review B 82, 075418 (2010).

28. 28.

Walker, C. T. & Pohl, R. O. Phonon scattering by point defects. Physical Review 131, 1432 (1963).

29. 29.

Seth, R. S. & Woods, S. B. Electrical Resistivity and Deviations from Matthiessen’s Rule in Dilute Alloys of Aluminum, Cadmium, Silver, and Magnesium. Physical Review B 2, 2961 (1970).

## Acknowledgements

The authors thank T. Markurt and M. Albrecht for providing the electron beam-induced deposition process. This work emerged from studies within the priority program “Nanostructured Thermoelectrics” SPP 1386 by the German Science Foundation (DFG). We gratefully acknowledge partial funding by DFG, partial financial support by BMBF grant 01DR17012 and HU Berlin.

## Author information

M.K., D.K., R.M. and S.F.F. contributed to the transport experiments, analyzed the data and wrote the manuscript, A.M. conducted the structural investigations, Z.W., M.Kr. and P.W. developed and provided the measurement platform TNCP, J.R. and P.W. synthesized the silver nanowires. All authors reviewed the manuscript.

Correspondence to M. Kockert or S. F. Fischer.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Kockert, M., Kojda, D., Mitdank, R. et al. Nanometrology: Absolute Seebeck coefficient of individual silver nanowires. Sci Rep 9, 20265 (2019). https://doi.org/10.1038/s41598-019-56602-9


text:
An Experimental Study of Cuttings Transport in Directional Slim Hole Drilling

Title & Authors
An Experimental Study of Cuttings Transport in Directional Slim Hole Drilling
Han, Sang-Mok; Kim, Jeong-Hwan; Hwang, Young-Kyu; Woo, Nam-Sub; Kim, Young-Ju;

Abstract
During drilling, the precipitation velocity of cuttings within an annulus depends on the density and configuration of the cuttings, and on the density, viscosity, and rheological characteristics of the drilling fluid. In directional drilling in particular, it is difficult to adjust and control the cuttings. In contrast to vertical drilling, it is very important to evaluate the flow characteristics of a drilling flow field. However, research on the transfer features of cuttings is inadequate. In this study, in order to identify transfer features of cuttings, an experiment was performed under wide-ranging conditions by constructing a slim hole annulus ($\small{44mm{\times}30mm}$) device. In this experiment, the particle volume fraction were influenced by particle size, particle concentration within the flow, pipe rotation, flow volume, and inclination of the annulus. In addition, a mathematical formula for volumetric concentration was deduced and compared to the test results and behavior of cuttings under the other drilling condition was made to be predicted. Therefore, this study can provide meaningful data for vertical and horizontal drilling, and for directional drilling.
Keywords
Directional drilling;Slim hole drilling;Drilling fluid;Cuttings;Solid-liquid two phase flow;
Language
Korean
Cited by
References
1.
Chakrabandhu, K. and Singh, R.K. (2005). "Rheological Properties of Coarse Food Suspensions in Tube Flow at High Temperatures", Journal of Food Engineering, Vol 66, No 1, pp 117-128.

2.
Duan, M., Miska, S., Yu, M., Takach, N. and Ahmed, R. (2008). "Transport of Small Cuttings in Extended-Reach Drilling", SPE Drilling and Completion, Vol 23, No 3, pp 258-265.

3.
Han, S.M., Kim, Y.J. Woo, N.S. and Hwang, Y.K. (2008). "A Study on the Solid-liquid 2 Phase Helical Flow in an Inclined Annulus", Journal of Mechanical Science and Technology, Vol 22, pp 1914-1920.

4.
Han, S.M., Woo, N.S. and Hwang, Y.K. (2009). "Solid-liquid Mixture Flow Through a Slim Hole Annulus with Rotating Inner Cylinder", Journal of Mechanical Science and Technology, Vol 23, pp 569-577, 2009.

5.
Iyoho, A.W. (1980). "Drilled-Cuttings Transport by Non-New tonian Drilling Fluids Through Inclined Eccentric Ann uli", Ph.D. Dissertation, University of Tulsa, Tulsa, OKUSA.

6.
Kelessidis, V.C. and Bandelis, G.E. (2004). "Flow Patterns and Minimum Suspension Velocity for Efficient Cuttings Tran sport in Horizontal and Deviated Wells in Coiled-Tubing Drilling", SPE Drilling & Completion, Vol 19, No 4, pp. 213-227.

7.
Kleinstreuer, C. (2003). "Two-Phase Flow: Theory and Applications", Taylor & Francis Group, New York.

8.
Larsen, T.I. (1990). "A Study of Critical Fluid Velocity in Cut tings Transport for Inclined Wellbores", M.S. Thesis, University of Tulsa, Tulsa, OK-USA.

9.
Tomren, P.H. (1979). "The Transport of Drilled Cuttings in an Inclined Eccentric Annulus", M.S. Thesis, University of Tulsa, Tulsa, OK-USA.

10.
Willoughby, D.A. (2005). "Horizontal Directional Drill-ing (HDD): Utility and Pipeline Applications", McGraw-Hill, New York.

11.
Woo, N.S., Kim, Y.J., Kwon, J.K., Chung, S.K. and Park, E.S. (2011). "A Study on the Solid-Liquid Rotating Flow for Cuttings Transportation in Inclined Annulus", Procee dings of the 21th International Offshore and Polar Engi neering Conference.


text:
Archived

This topic is now archived and is closed to further replies.

Annoying Managed DirectDraw Surface.Lock Bug

This topic is 5353 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Surface.Lock returns a byte[*,*] array. Writinng to this byte array does not fill the entire surface. I don''t think pitch can really be ussed in this situation since the array has a limit on its dimensions. I have heard of SEVERAL people that have this same problem, and it''s quite frustrating. Is there ANY way at all of direct surface manipulation? When is this expected to be fixed?

Share on other sites
pitch is always used, no matter what kind of surface you use. if you did not take care of the pitch it's clear you won't be able to fill the screen.

EDIT: Lock does not give back a byte[*,*], it gives back a byte*. look at it like a file which has some predefined gap between lines and not like a thight fitting bitmap.

[edited by - RPTD on March 24, 2004 3:27:48 PM]

Share on other sites
The version of DirectX 9 I have returns a byte[,]. I am using Managed DirectDraw, and the wrapper somewhat disappoints me. What I meant about pitch is th at the values in the byte array clearly don't match up with the image coordinates, and there is no way to access an index outside of the bounds of the array, which the pitch might suggest.

Here is my code.

				byte[,] image;				//Lock the surface				image= surf.Lock(LockFlags.SurfaceMemoryPointer | LockFlags.Wait);					//loop through all of the ys				for(int y=0; y<image.GetUpperBound(1); y++)				{					//and through every x that corresponds to that y					for(int x=0; x<image.GetUpperBound(0); x++)					{						//Just set it to black/						image[x,y]=0;					}				}				//Unlockf				this.surf.Unlock(image);

And I've tried using pitch, and I'll get an OutOfBounds exception I think. I dont fancy much the 2 dimmensional approach that they've taken with this.

[edited by - Muzlack on March 24, 2004 5:13:30 PM]

Share on other sites
Yeah I had that problem when I tried locking a surface too. I ended up doing a color fill to the points I needed. Slow, but it worked for my purposes.

Share on other sites
what language and wrapper you use? i personally never use wrappers cause they tend to crank up more than they help. if you can try casting it (clean cast or dirty cast) it to a simple byte pointer and then access it like that (or use mem functions), whatever way you have to access a one dimensional byte data area.

Share on other sites
I''m using C#, and I''m making my own wrapper. Is it possible to use non-managed DirectX? I''m familiar with C++, and in fact, I''m porting my engine to C#, so if it were possible to use the same data structures etc. that I''m using, that would be cool.

*bump*

Share on other sites
*bump* again. I''ve read a *lot* of complaints like these but no solution as of yet. has anyone figured this out?

Share on other sites
I have had the same problem. From what I am looking at it looks as if it converts whats in memory directly to a 2d array.

The issue is I think IS casting. if you just do a :
Array temp = surfaceSecondary.Lock(LockFlags.SurfaceMemoryPointer);

I produces a 1024,768 array of shorts. Short being the default size of the Array class.

Humm... You know, I wonder what happens if you cast it to long. Maybe, since it gives an Array on the size of the screen, it also depends on the depth of the screen.

Aka, it needs to be an Int32 because my screen is at 32 bits.

I am checking on this.

Share on other sites
Still waiting for my regestration information.

Ok, I am using remote desktop, so apperently thats why it was in shorts.

Check this out. Try running the DirectX9 wizard and making a DirectDraw project. Plop this code in and run it though the Quick watch.
// Snip
temp = surfaceSecondary.Lock(LockFlags.SurfaceMemoryPointer);
surfaceSecondary.Unlock(temp);

surfaceSecondary.ColorFill(Color.Yellow); // Change this and see the array values change!

temp = surfaceSecondary.Lock(LockFlags.SurfaceMemoryPointer);
surfaceSecondary.Unlock(temp);

// Snip

It looks like that Lock comamnd just gives a nice raw buffer of the surface. Since I am set up at 16-bit/1024x768 it makes an array of Int16, 1024 long, 768 tall. Only problem is clipping. If your not using full screen, you have to remeber where the clip window is.

Humm. Can''t wait to get home and try this.

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 26
• 11
• 9
• 9
• 11
• Forum Statistics

• Total Topics
633709
• Total Posts
3013481
×


text:
# How do you divide 4/(-3-6i)?

Aug 30, 2016

$- \frac{4}{15} + \frac{8}{15} i$

#### Explanation:

To divide this fraction we require the denominator to be $\textcolor{b l u e}{\text{real}}$

To obtain this multiply (-3 - 6i) by it's $\textcolor{b l u e}{\text{conjugate}}$

The conjugate of (-3 - 6i) is (-3 + 6i). Note that the real part remains unchanged while the $\textcolor{red}{\text{sign}}$ of the imaginary part is reversed.

$\Rightarrow \left(- 3 - 6 i\right) \left(- 3 + 6 i\right) = 9 - 18 i + 18 i - 36 {i}^{2} = 45 \text{ a real number}$

$\textcolor{\mathmr{and} a n \ge}{\text{Reminder }} \textcolor{red}{| \overline{\underline{\textcolor{w h i t e}{\frac{a}{a}} \textcolor{b l a c k}{{i}^{2} = {\left(\sqrt{- 1}\right)}^{2} = - 1} \textcolor{w h i t e}{\frac{a}{a}} |}}}$

Since this is a fraction, we also have to multiply the numerator by (-3 + 6i)

$\frac{4}{- 3 - 6 i} \times \frac{- 3 + 6 i}{- 3 + 6 i} = \frac{4 \left(- 3 + 6 i\right)}{\left(- 3 - 6 i\right) \left(- 3 + 6 i\right)}$

$= \frac{- 12 + 24 i}{45} = - \frac{12}{45} + \frac{24}{45} i = - \frac{4}{15} + \frac{8}{15} i$


text:
Integral part and fractional part

Algebra Level 4

On your calculator you have the number $4 + \frac{ -7 + \sqrt{53} } { 2} \approx 4.14005494464$ and by mistake you hit the key that squares the number giving you $17 + \frac{ -7 + \sqrt{53} } { 2} \approx 17.14005494464$.

You notice that the whole number part of the number and the whole number part of the square of the number has changed (4 to 17) but that the decimal parts of both are still the same.

How many numbers strictly between 4 and 5 have that property? (That is, when you square the number, the whole number part changes but the decimal part remains the same.)

×


text:
Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Chemical property prediction under experimental biases

## Abstract

Predicting the chemical properties of compounds is crucial in discovering novel materials and drugs with specific desired characteristics. Recent significant advances in machine learning technologies have enabled automatic predictive modeling from past experimental data reported in the literature. However, these datasets are often biased because of various reasons, such as experimental plans and publication decisions, and the prediction models trained using such biased datasets often suffer from over-fitting to the biased distributions and perform poorly on subsequent uses. Hence, this study focused on mitigating bias in the experimental datasets. We adopted two techniques from causal inference combined with graph neural networks that can represent molecular structures. The experimental results in four possible bias scenarios indicated that the inverse propensity scoring-based method and the counter-factual regression-based method made solid improvements.

## Introduction

Predicting the chemical properties of compounds is crucial in discovering novel materials and drugs with specific desired characteristics. Various computational approaches, including those based on density functional theory, have been widely used to accelerate the discovery process; however, they remain expensive and time consuming. In recent decades, researchers have shifted to data-driven approaches by fast-progressing machine learning technologies1. Recently, this trend has been further accelerated by the remarkable development of deep learning; in particular, graph neural networks (GNNs)2,3 have achieved remarkable performance in predicting chemical properties via automatic feature extraction from molecular structures represented as graphs4,5,6,7,8,9,10. Their applications have expanded to various tasks, such as molecular generation11,12,13, molecular explanation14,15, and analysis of inter-molecular interactions16,17.

Accurate predictive models often rely on large-scale labeled datasets; they are frequently collections of knowledge (e.g., experimental results reported on scientific papers) that are the product of extensive scientific efforts. Unsurprisingly, scientists do not uniformly sample molecules from a large chemical space at random nor based on their natural distribution (i.e., the actual distribution of molecules existing in the chemical space) . Rather, their decisions on experimental plans or publication of results are biased due to physical, economic, or scientific reasons. For instance, a large proportion of molecules are not investigated experimentally because of molecular mechanics-related factors, such as solubility18, weights19, toxicity20, and side effects, or molecular structure-related factors, such as crystals21. In the pharmaceutical domain, drug likeness is an important factor for target selection, as exemplified by “Lipinski’s rule of five”22. Further, concerns about the cost and availability of molecules can be some reasons to exclude certain groups of molecules. Conversely, popularity considerations based on current research trends23 and the experimental methods wherein each lab specializes24 influence the selection of compounds. These propensities related to researchers’ experience and knowledge can contribute to more efficient search and discovery in the chemical space; however, they influence the data in an undesirable manner. Biases from human scientific research result in datasets that are sampled from distributions that differ from the natural ones. Thus, prediction models trained using such biased datasets suffer from over-fitting to the biased distributions, leading to poor performance on subsequent uses 25,26,27,28.

Evidence on the existence of bias in scientific experiments and their harmful effects has been reported 18,19,20,21,22,23,24,25,26,27,28. However, almost no attempts to address this challenge have been found. The problems of learning prediction models, when the distributions of the training and test datasets are different, are called domain adaptation, covariate shift adaptation29, or transfer learning30, and they have been a major topic in machine learning. Recently, deep neural networks for domain adaptation based on the concept of domain-invariant representation learning were proposed31,32,33,34,35,36,37, which have been primarily applied in the study of images. The problem of biased observations is also discussed in the context of causal inference. Inverse propensity scoring (IPS) is a general method from causal inference38,39, which has been successfully applied to various applications such as recommender systems39,40, natural language processing41, and treatment estimation in different fields ranging from healthcare42, economy43, and education44. Meanwhile, the domain-invariant representation learning concept is also introduced in the context of causal inference45. Counter factual regression (CFR) is a classic method which has been successfully applied for predicting individual treatment effect45,46,47 by obtaining balanced representation such that the induced treated and control distributions look similar.

In this study, we focused on mitigating the sources of bias in experimental datasets by applying the IPS and CFR techniques from causal inference. With the IPS approach, we first estimate the propensity score function, which represents the probability of each molecule to be analysed, and then estimate the chemical property prediction model by weighting the objective function with the inverse of the propensity score. The CFR approach consists of one feature extractor, several treatment outcome predictors and one internal probability metric, where the feature extractor obtains features that aid the treatment outcome predictors and the internal probability metric, and the entire network is optimized in an end-to-end manner. Hassanpour et al.47 further introduce an importance sampling weight estimator to improve the CFR architecture.

Both approaches were implemented over a GNN to study the molecular structures of the compounds. To the best of our knowledge, we are the first to combine chemical property prediction based on graph deep learning and sampling bias correction techniques. Figure 1 shows the main aim of this study.

Our experiments used two well-known large-scale dataset QM948 and ZINC49, and two relatively smaller datasets ESOL and FreeSolv50. QM9 consists of exhaustively enumerated small-molecule structures associated with 12 fundamental chemical properties51, In contrast, molecule structures in ZINC, ESOL, and FreeSolv are far less than exhaustively enumerated and they are associated with one property for each dataset. Because determining how a publicly available dataset is truly affected by bias is impossible, we simulated four practical biased sampling scenarios from the dataset, which introduced significant biases in the observed molecules. Under each biased sampling scenario, we validated our proposed models in predicting 15 chemical properties using 15 regression problems. The experimental results indicated that both the two-step IPS approach and the more modern end-to-end CFR approach improved the predictive performance in all the scenarios on most of the targets with statistical significance compared with the baseline method , and in addition, the CFR approach outperformed the IPS approach on most of the targets.

In summary, the main contributions of this paper are as follows:

• We first address the problem of predicting properties of chemical compounds under experimental biases.

• We introduce two bias mitigation techniques, IPS and CFR, combined with GNN-based prediction of chemical properties.

• We validated the two proposed approaches using various experimentally biased sampling scenarios and demonstrated that both of them improves the predictive performance significantly.

## Results

### Problem setting of predicting chemical properties under experimental biases

We assume a training dataset $$\mathscr {D}^\text {train} = \{(G_i,y_i){\}_{i=1}^N}$$ that includes N molecular graphs, where $$G_i \in \mathscr {G}$$ is a molecular graph (biasedly) sampled from a large chemical space $$\mathscr {G}$$, and $$y_i \in \mathbb {R}$$ is the target chemical property. Each molecular graph $$G_i=(\mathscr {V}_i,\mathscr {E}_i, \sigma _i) \in \mathscr {G}$$ has a set of nodes (i.e., atoms) $$\mathscr {V}_i$$, a set of edges (i.e., bonds) $$\mathscr {E}_i \subseteq \mathscr {V}_i \times \mathscr {V}_i$$, and a label function $$\sigma : \mathscr {V}_i \cup \mathscr {E}_i \rightarrow \mathscr {L}$$ . Here, $$\mathscr {L}$$ is the set of possible node labels (i.e., atom types such as hydrogen and oxygen) and edge labels (i.e., bond types such as double bond and aromatic bond). Our aim is to obtain a prediction function $$f: \mathscr {G}\rightarrow \mathbb {R}$$ that predicts a particular target chemical property over the chemical space $$\mathscr {G}$$ that we are interested in. We assume that we have a uniformly randomly sampled part of (or possibly the entire) $$\mathscr {G}$$ , consisting of M molecules $$\mathscr {D}^\text {test} = \{G_i{\}}_{i=N+1}^{N+M}$$.

This problem is difficult because the training data are constructed from past experiments reported in the literature; therefore, they are significantly biased with respect to the uniform distribution over the chemical space $$\mathscr {G}$$ because of the decisions implemented by researchers on experimental plans or publication options. Hence, there is no guarantee that the predictor derived from the biased training data has high predictive performance even on the chemical space $$\mathscr {G}$$ .

Note that the $$\mathscr {D}^\text {test}$$ can also be a biased sample; however, without loss of generality, we only assume it is a uniformly random subset of the molecules that we are interested in.

In summary, the inputs and outputs of the problem are as follows:

Input: molecular graph $$G_i=(\mathscr {V}_i,\mathscr {E}_i, \sigma _i)\in \mathscr {G}$$ in $$\mathscr {D}^\text {train}$$ and $$\mathscr {D}^\text {test}$$ for training and test, respectively.

Output: one target chemical property $$\hat{y}_i \in \mathbb {R}$$.

The ordinary setting is included in our problem setting when $$\mathscr {D}^\text {train}$$ and $$\mathscr {D}^\text {test}$$ come from the same distribution.

We use Mean Absolute Error (MAE) to evaluate the predictive performance of a model, which is defined as

\begin{aligned} MAE = \frac{1}{M}\sum _{i=1}^{M}{|\hat{y}_i - y_i|}. \end{aligned}

### Comparison of predictive performance

Figures 2 and Figures 3 show all the MAE comparison results (in the mean and standard deviations of 30 trials) corresponding to the four simulated biased sampling scenarios. The * symbols above the bars denote the p-values of the paired t-test when comparing Baseline (without bias mitigation) with IPS and CFR, respectively; ** means the p-value was less than 0.01, and * means that it was less than 0.05. Note that, in the case of QM9, the result for the HOMO-LUMO gap (denoted by ‘gap’) in Scenario 3 was equivalent to that in Scenario 4 because QM9 contains HOMO-LUMO gap information,

The overall results for all the scenarios indicated that the IPS approach improved the performance for many properties and scenarios; in particular the performance was statistically significantly improved for the five properties of QM9 (zvpe, u0, u298, h298, and g298) in all of the four scenarios, and for the three properties of QM9 (mu, alpha, cv) in three out of four scenarios, which indicated that IPS has solid effectiveness and potential in mitigating experimental biases on these tasks. However, we found that there were some statistically insignificant comparison and even significant failure for the four properties of QM9 (homo, lumo, gap, r2) and the properties of ZINC, ESOL, and FreeSolv. These failures indicated that although IPS achieved improvements on most of the tasks, it was not stable. In addition, the improvements by IPS of QM9 were more significant for Scenarios 1 and 2 than Scenarios 3 and 4. The differences might be explained by the accuracy of the propensity score model; the accuracies in the four scenarios were 81.05%, 87.49%, 76.04%, and 79.02%, respectively, which meant that the propensity scores were more accurate in Scenarios 1 and 2.

The CFR approach achieved more remarkable predictive performance than the IPS approach for most of the properties and scenarios. For the four properties of QM9 (homo, lumo, gap, and r2) and the three properties of ZINC, ESOL, and FreeSolv in all of the four scenarios (except for lumo and the property of ESOL in Scenario 2), where IPS failed to improve the predictive performance, CFR achieved statistically significant improvements comparing to the baseline method. Further, for the four properties of QM9 (mu, alpha, zvpe, and cv) in all of the four scenarios (except for alpha in Scenario 1), the improvements achieved by CFR were more remarkable than IPS. However, we found that for the four properties of QM9 (u0, u298, h298, g298), where IPS achieved remarkable improvements, CFR failed to show statistically significant increasing or decreasing of predictive performance comparing to the baseline method, which indicated that CFR was not always effective.

In summary, both of the IPS and CFR approaches made solid improvements in mitigating experimental biases for most of the properties and scenarios, and CFR showed better performance than IPS. However, some failures also indicated that the IPS and CFR approaches were not stable.

### Prediction accuracy depending on indicators for biased sampling

We further investigated why the IPS and CFR approaches successfully corrected the bias by visualizing the prediction accuracy depending on the indicators used in the biased sampling scenarios. Because of space limitations, we only show the predictive performance for the chemical property mu and u0 of QM9 in Figure 4. Similar results can be observed on other tasks. The horizontal axes in the figure correspond to the indicators, namely, (a) the number of atoms, (b) the proportion of double/triple/aromatic bonds, (c) the value of the HOMO-LUMO gap (gap), and (d) the value of the target (i.e., mu for the top and u0 for the bottom), respectively. The top four figures correspond to the average test MAE (that is, the smaller, the more accurate) of predicting mu of QM9 and the bottom four figures correspond to the average test MAE of predicting u0 of QM9. Note that we obtained the average test MAEs in Figure 4 from another 30 trials of biased sampling and model training.

For predicting mu, according to the MAE comparison results, we know that both IPS and CFR achieved significant improvements of predictive performance for most scenarios and CFR outperformed IPS. In Scenario 1, most of the molecules used for training had a number of atoms ranging from 5 to 15. For predicting mu of molecules with 15 or more atoms, primarily in the test dataset, IPS and CFR consistently outperformed the baseline method, and in addition, CFR consistently outperformed IPS. In Scenario 2, most of the molecules used for training had a proportion of double/triple/aromatic bonds higher than 0.4. Again, on those molecules with proportion less than 0.4, IPS and CFR consistently performed better than the baseline method, and CFR almost outperformed IPS. Similarly in Scenarios 3 for predicting mu, we observed the advantage of CFR for the smaller indicator values (less than 0.2) corresponding to the test datasets. However, in Scenario 4, we failed to observe the similar advantages of IPS and CFR for smaller indicator values, which was not consistent with our findings in Figure 2. This failure also indicated that the IPS and CFR approaches lacked stability on some tasks.

For predicting u0, we know that IPS achieved significant improvements of predictive performance for all scenarios while CFR failed. For predicting mu of molecules with 15 or more atoms, IPS consistently outperformed the baseline method while CFR almost failed. In Scenario2, IPS achieved better performance on those molecules with proportion less than 0.4, which was consistent with our findings. However, the performance of CFR was not consistent, which further indicated the low stability of this method on this task. In Scenario 3 and 4 for predicting u0, we observed the advantage of IPS for the smaller indicator values corresponding to the test datasets while we failed to observe the advantage of CFR, which was consistent with our findings.

In summary, by visualizing the prediction accuracy depending on those indicators for biased sampling, we can partially conclude that, on most of the tasks, IPS and CFR improved the predictive performance on molecules with lower chance for observation, which led to the overall improvements.

## Discussion

We considered the prediction of chemical properties from datasets that have experimental biases. We introduced two promising bias mitigation techniques by combining the recent developments in causal inference and GNN-based graph learning. We tested four practical biased sampling scenarios on the well-known QM9, ZINC, ESOL, and FreeSolv datasets for experiments. The experimental results confirmed that the two approaches improved the predictive performance in all scenarios on most of the tasks with statistical significance compared with the baseline method, which had no effort for bias mitigation. We also found that the more modern CFR approach outperformed the IPS approach for most of the tasks and scenarios. However, based on our experimental results, the IPS and CFR approaches were not stable enough, which should be further improved. We attribute some of this failure in part to the discussion on transferability and discriminability 52. When the information that is useful for discriminating the biased and unbiased data is also useful for predicting some chemical properties, it is eliminated by IPS and CFR, resulting in poor discriminability (i.e., prediction power).

Further, as a new study, we would like to describe the future scope in two directions. The fundamental direction of our research is to mitigate experimental biases in scientific research. In this study, we only focused on the population of chemical compounds and the task of property prediction. Possible future topics are extensions to more complex prediction tasks under experimental biases, including chemical-chemical link prediction in the chemical domain, biological network prediction in the biological domain, and discovery of unknown compounds in the material science domain. Another possible direction is applications of more modern and robust methods in covariate shift, causal inference, and domain adaptation. Since the difficulty in our problem setting lies mainly in learning unbiased representation of biased observed instances, it would be promising to adapt general ideas from those related areas and to develop theories and techniques for our specific tasks.

## Materials and methods

### Datasets

We first used the chemical molecule dataset QM948. QM9 is a publicly available dataset containing 134,000 small stable organic molecules composed of hydrogen (H), carbon (C), oxygen (O), nitrogen (N), and fluorine (F). They are the subset of all the molecules with up to nine heavy atoms (C, O, N, F) out of the 166 billion molecules of the GDB-17 chemical universe48,51; therefore, the QM9 dataset can be considered to have a close distribution to the natural universe of molecules comprising C, O, N, and F. Each molecule in QM9 has 12 fundamental properties: dipole moment (mu), isotropic polarizability (alpha), HOMO (homo), LUMO (lumo), gap between the homo and lumo (gap), electronic spatial extent (r2), zero point vibrational energy (zpve), internal energy at 0 K (u0), internal energy at 298.15 K (u298), enthalpy at 298.15 K (h298), free energy at 298.15 K (g298), and heat capacity at 298.15 K (cv); they were used as 12 targets for 12 regression tasks.

We further used three chemical molecule datasets, i.e., ZINC 49, ESOL, and FreeSolv 50. The ZINC dataset contains 250,000 drug-like commercially available molecules graphs with up to 38 heavy atoms. The task of ZINC is to predict a molecular property known as constrained solubility. ESOL is a small dataset consisting of water solubility data for 1,128 molecular graphs. FreeSolv is also a small dataset consisting of 643 molecular graphs with hydration free energy of small molecules in water. Note that molecule structures in these three datasets are far less than exhaustively enumerated. Thus, in contrast with QM9, there is no guarantee that the $$\mathscr {D}^\text {test}$$ of these three datasets can be regarded as an unbiased subset of a chemical space . However, without loss of generality, we only assume the $$\mathscr {D}^\text {test}$$ is unbiased or less biased (compared with the $$\mathscr {D}^\text {train}$$) corresponding to the indicators that we used to induce biases.

### Biased sampling scenarios

Because we cannot know why the compounds reported in the literature were selected, we simulated several possible scenarios to sample our training datasets. We considered the following four possible biased sampling scenarios:

• Scenario 1 assumes that molecules with a smaller number of atoms have higher sampling chances, because smaller molecules are considered more common and better explored22.

• Scenario 2 prefers molecules with smaller proportions of single bonds (i.e., with higher proportions of the other bond types). The spectral manifestations of chemical functional groups significantly depend on bond types within the group53. For simplicity, we assumed that less single-bonded molecules would have stronger spectral manifestations.

• Scenario 3 selects molecules with higher values of the gap between the highest energy occupied molecular orbital (HOMO) and lowest energy unoccupied molecular orbital (LUMO), because larger HOMO-LUMO gap values often indicate higher stability and lower chemical reactivity54.

• Scenario 4 assumes that scientists focus on compounds with high target property values based on their expertise and experience to conduct experiments. Further, compounds with higher targets values have higher sampling chances.

We first sampled a test dataset with a size of 10% of the entire dataset uniformly at random. Then, according to each of the four biased sampling scenarios, we sampled a biased training dataset from the remaining molecules. Each compound had a sampling chance determined by the sigmoid function depending on the corresponding sampling criteria. Take QM9 for example, in Scenario 1, the smallest molecules with three atoms had the largest sampling chances, while the ones with 27 atoms had the smallest chances. The larger the gain of the sigmoid curve becomes, the more the training and test datasets were separated; we tuned the gain to bring the average sampling probability to 10%. We used sampling without replacement; therefore, no graph belonged to the training and test sets simultaneously. We repeated the sampling procedure 30 times to build training and test datasets for statistical testing. Figure 5 shows the average densities of the 30 trials under the biased sampling scenarios of QM9 (for Scenario 4, only the first target among the 12 targets is shown because of the page limitation). The average densities of ZINC, ESOL, and FreeSolv were similar to those in the Scenario 1, 2, and 4 of QM9 in Figure 5. Note that Scenario 3 was not performed on these datasets because HOMO-LUMO gap information is not contained in ZINC, ESOL, and FreeSolv.

### Methods

We begin by reviewing the GNN architecture that is the fundamental building block of our model, and then we describe two bias canceling schemes: IPS and CFR. They are combined to solve the problem of chemical graph property prediction under experimental biases. We summarize the symbols used in this paper in Table 1.

#### GNNs to predict chemical properties

Among many successful GNNs, we selected the message-passing GNN architecture proposed by Gilmer et al.5 owing to its generality, simplicity, and fair performance in the chemical domain.

A GNN uses a graph $$G=({\mathcal V},{\mathcal E}, \sigma ) \in \mathscr {G}$$ as its input. In the t-th layer of the GNN, it updates the current set of the node representation vectors $$\{\mathbf {h}^t_v\}_{v \in V_i}$$ to $$\{\mathbf {h}^{t+1}_v\}_{v \in V_i}$$. Specifically, the representation vector of node v is updated depending on the current vectors of its neighbor nodes using the following update formula:

\begin{aligned} \mathbf {m}_v^{t+1}&=a \left( \sum _{u \in \mathscr {N}(v)} m_t \left( \mathbf {h}_v^t,\mathbf {h}_u^t,\sigma (v,u)\right) \right) , {~~~} \mathbf {h}_v^{t+1}=u_t\left( \mathbf {h}_v^t,\mathbf {m}_v^{t+1}\right) , \end{aligned}

where $$\mathscr {N}(v)$$ denotes the set of the neighbor nodes of v, and $$m_t$$ is a so-called message passing function that collects the information (i.e., the representation vectors) of the neighbors, and it is a linear function of $$(\mathbf {h}_v^t,\mathbf {h}_u^t)$$ depending on the edge label $$\sigma (v,u)$$. Further, a is an activation function, for which we select the rectified linear unit (ReLU) function, and $$u_t$$ is the vertex update function, for which we use the gated recurrent unit (GRU). The initial node representations $$\{\mathbf {h}_v^0\}_{v \in \mathscr {V}}$$ are initialized depending on their atom types. As the message passing operation is repeatedly applied, the node representation vector gradually incorporates information about its surrounding structure.

After being processed through T layers, the final node representations $$\{\mathbf {h}_v^{T}\}_{v \in \mathscr {V}}$$ are obtained; they are aggregated to the graph-level representation $$\mathbf {h}_{G}$$ using a readout function $$\mathbf {h}_{G} =r \left( \{\mathbf {h}_v^{T}\}_{v \in \mathscr {V}}\right)$$, where we could simply use summation, followed by a linear transformation as the readout function. However, in our implementation, we used a slightly more complex solution: a long short-term memory (LSTM) pooling layer, followed by a linear layer. The graph-level representation $$\mathbf {h}_{G}$$ is passed to the final layer to achieve the outputs of the GNN, such as the chemical property, propensity score, and domain weights prediction, as we discuss later.

#### Bias correction using IPS

If we assume that no biases exist in our training dataset, the distributions of the training and target (test) datasets are identical. This implies that minimizing the empirical mean of the loss function $$\ell$$, that is, $$\frac{1}{N}\sum _{i=1}^N \ell (y_i,f(G_i)),$$ directly obtains a good prediction model g that achieves a small expected loss $$\text {E}[\ell (y,g(G))]$$ for the test data. However, because the training dataset is sampled in a biased manner in our scenario, the minimization of the standard empirical loss results in a biased prediction model.

A possible remedy to this problem is the use of a propensity score38 to adjust the importance weight of each training instance. The propensity score $$\pi (G)$$ of molecular graph G is the probability that the molecule is included in the experimental data. The loss for each molecule is inversely weighted with the propensity score, resulting in the modified objective function:

\begin{aligned} o^\text {IPS}(f)=\frac{1}{N}\sum _{i=1}^N \frac{1}{\pi (G_i)}\ell (y_i,f(G_i)). \end{aligned}

With the correct propensity score function $$\pi$$, the weighted loss function is unbiased with respect to the uniform sampling from the chemical space $$\mathscr {G}$$ . As shown in Figure 6, the IPS approach involves two steps: propensity score estimation and chemical property prediction. We first estimated the propensity score function that represents the probability of each molecule being experimented. It is estimated from the biased training dataset and the unbiased test set (uniformly sampled from the chemical space $$\mathscr {G}$$ ). This step is frequently performed by solving a two-class probabilistic classification problem to classify the two datasets using the logistic loss (also called the cross-entropy loss). Note that the target property values are not used for propensity modeling. The second step estimates the chemical property prediction model with the loss function weighted using the inverse of the propensity score. We used the squared loss function as $$\ell$$, and the problem is cast as a weighted regression problem. The propensity score function and chemical property prediction model are both implemented as GNNs because they use graph-structured molecules as their inputs.

#### Bias correction using CFR

The CFR approach is another option to correct sample selection biases. We adopted the method proposed by Hassanpour et al.47, which is an improvement of the best-known method proposed by Shalit et al.45. To apply CFR on our tasks, we introduce $$d_i\in \{0,1\}$$ to indicate the treatment (i.e., domain in general) that $$G_i$$ belongs to (i.e., test or training). The method has four components: a feature extractor, label predictor (replacement of the original treatment outcome predictors), internal probability metric, and weight estimator, denoted by $$f_{\text{ F }}$$, $$f_{\text{ L }}$$, $$f_{\text{ IPM }}$$, and $$f_{\text{ W }}$$, respectively. Different from the original causal effects estimation setting, only the molecular graphs from $$\mathscr {D}^\text {train}$$ will be passed trough the treatment outcome predictors because molecular graphs from $$\mathscr {D}^\text {test}$$ have no labels. Thus, there is only one treatment outcome predictor exists in our model for predicting chemical property, which we call label predictor. As shown in Figure 7, in contrast with IPS, which has two separate GNN models, three paths exist in one single model; the first path is for predicting chemical property of $$G_i\in \mathscr {D}^\text {train}$$, and it is specified by a label predictor $$f_{\text{ L }}$$ concatenated after a feature extractor $$f_{\text{ F }}$$. The second path, which takes a batch of molecular graphs $$\{G_i\}\subseteq \mathscr {D}^\text {train} \cup \mathscr {D}^\text {test}$$ as input, is for measuring distance between distributions, which is specified by internal probability metric $$f_{\text{ IPM }}$$ concatenated after the feature extractor $$f_{\text{ F }}$$. The third path is for estimating weight of $$G_i\in \mathscr {D}^\text {train} \cup \mathscr {D}^\text {test}$$, which is specified by an estimator $$f_{\text{ W }}$$ concatenated after the feature extractor $$f_{\text{ F }}$$; Note that $$f_{\text{ F }}$$ commonly appears in all of the paths. The final deliverable f that we desire is the composite function of $$f_{\text{ F }}$$ and $$f_{\text{ L }}$$; that is, $$f(G)=f_{\text{ L }}(f_{\text{ F }}(G)$$. The weight estimator and the internal probability metric are not our final objective, but they aid in extracting debiased representations of the inputs in the training phase.

In the training phase, the first path (consisting of $$f_{\text{ F }}$$ and $$f_{\text{ L }}$$) aims to predict the target chemical property, by minimizing

\begin{aligned} o^\text {property}(f_{\text{ F }},f_{\text{ L }}) = \frac{1}{N} \sum _{i=1}^N w_i \ell (y_i, f_{\text{ L }}(f_{\text{ F }}(G_i))), \end{aligned}

where $$\ell$$ is the loss function for chemical properties, namely, the squared loss in our case. Term $$w_i$$ is the importance sampling weight. According to Hassanpour et al 47, if we denote $$\phi _i=f_{\text{ W }}(f_{\text{ F }}(G_i))\in \mathbb {R}^2$$ (outputs of two domains) and use softmax function to obtain probabilities, $$w_i=\frac{1}{\Pr (d_i|G_i)}=1+e^{\phi _i^{(1-d_i)}-\phi _i^{(d_i)}}$$ when $$N=M$$, which is similar to inverse propensity score in the IPS approach. Note that in our case, $$d_i$$ is fixed to 1 while calculating $$w_i$$ because only $$G_i\in \mathscr {D}^\text {train}$$ will be passed through $$f_{\text{ L }}$$. In the second path (including $$f_{\text{ F }}$$ and $$f_{\text{ IPM }}$$), the internal probability metric $$f_{\text{ IPM }}$$ aims to measure the distance between distributions of molecular graphs from $$\mathscr {D}^\text {train}$$ and $$\mathscr {D}^\text {test}$$. The objective function for the second path is expressed as

\begin{aligned} o^\text {IPM}(f_{\text{ F }},f_{\text{ IPM }}) = f_{\text{ IPM }}(\{f_{\text{ F }}(G_i)\}_{i:d_i=0}, \{f_{\text{ F }}(G_i)\}_{i:d_i=1}). \end{aligned}

In the third path (including $$f_{\text{ F }}$$ and $$f_{\text{ W }}$$), the $$f_{\text{ W }}$$ aims to correctly classify the domain (i.e., test or training) of the input. Denoting the loss function for domain classification (i.e., the cross-entropy loss in our case) by c, the objective function for the third path is expressed as

\begin{aligned} o^\text {domain}(f_{\text{ F }},f_{\text{ W }}) = \frac{1}{N+M} \sum _{i=1}^{N+M} c(d_i, f_{\text{ W }}(f_{\text{ F }}(G_i))). \end{aligned}

Parameters of $$f_{\text{ F }}$$, $$f_{\text{ L }}$$, and $$f_{\text{ IPM }}$$ are updated by minimizing the objective function $$o(f_\text {F},f_\text {L},f_\text {IPM})=o^\text {property}(f_{\text{ F }},f_{\text{ L }}) + \alpha \cdot o^\text {IPM}(f_{\text{ F }},f_{\text{ IPM }})$$, where $$\alpha$$ is a hyper-parameter. Note that $$f_{\text{ W }}$$ is set to evaluating mode for calculating $$o^\text {property}(f_{\text{ F }},f_{\text{ L }})$$ so that there are no gradients accumulated in $$f_{\text{ W }}$$ during this backward process. After the update of $$f_{\text{ F }}$$, $$f_{\text{ L }}$$, and $$f_{\text{ IPM }}$$, $$f_{\text{ W }}$$ is set to training mode, and parameters of $$f_{\text{ W }}$$ are then updated by minimizing $$o^\text {domain}(f_{\text{ F }},f_{\text{ W }})$$.

#### Implementation details

We used the PyTorch Geometric library55 to implement the GNN models. In QM9 and ZINC, each atom is encoded as a 13 and 28-dimensional vector (one hot), respectively, depending on the atom type. In ESOL and FreeSolv, we followed the settings in MoleculeNet 50, where each atom is encode as a 9-dimensional vector. The message passing function $$m_t$$ depends on edge types and is 32-dimensional. The update function $$u_t$$ is a gated recurrent unit with 32 internal dimensions. The readout function r is a sequence-to-sequence layer followed by two linear layers with 32 internal dimensions.

The IPS approach required two GNN models, one for the propensity score function and the other for chemical property prediction. In the former, we used $$T=3$$ GNN layers and a logistic function as the final layer because the propensity score indicated the probability that a chemical compound is observed. We used the ADAM56 optimizer with no weight decay and a batch size of 64 for each iteration. We used a learning rate updating scheduler with an initial learning rate of $$1e-5$$; this reduced the learning rate by a factor of 0.7 until the validation error stopped reducing for five training epochs. The validation datasets were randomly selected to include 20% of the training and test sets. The optimized model that achieved the lowest validation error on the validation dataset was applied to infer the importance. The chemical property prediction models also had $$T=3$$ GNN layers, and the other training settings were almost the same as those for the propensity score model. The validation set was 20% of the training set. Because we had 15 target chemical properties, we trained 15 different GNN predictors.

The network structure for the CFR approach had three output paths: the label predictor, internal probability metric, and weight estimator. The label predictor and weight estimator shared the common feature extraction layers on the input side. We set the number of the GNN layers corresponding to the feature extractor and those for the weight estimator and label predictor to 3. Similar to the IPS approach, the weight estimator had a readout function for classification and the label predictor had one for regression. Note that the feature extractor had no readout function. We used Wasserstein distances57 for the internal probability metric. In addition, before the internal probability metric, there was readout function to aggregate features extracted by the feature extractor to a batch of graph-level features. We set the $$\alpha$$ for QM9, ZINC, ESOL, and FreeSolv to 10, 10, 100, and 10, respectively. As with the IPS approach, we used ADAM with no weight decay as the optimizer. We also used a learning rate updating scheduler, with an initial learning rate of $$1e-5$$ and reduced the learning rate by a factor of 0.7 until the validation error stopped reducing for five training epochs. The batch size was set to 64. In contrast with IPS, the entire network was trained in an end-to-end manner. We trained 15 GNNs for each of the target properties in each trial. 20% of the training and test sets were used to validate the domain classifier, and 20% of the training set was used for the label predictor.

As the baseline method, we used the same GNN structure as the one for IPS, but without bias mitigation. In contrast to the IPS approach, we used the standard unweighted average loss for the training dataset. The same settings as for IPS were used except for those specific to IPS, such as the number of GNN layers, the selection of the hyperparameters, and the training and validation sets.

## Data availability

The datasets used and/or analysed during the current study are all available at https://pytorch-geometric.readthedocs.io/en/latest/modules/datasets.html. We further processed these datasets with biased sampling scenarios, which were introduced in Material and Methods section. The processed datasets used and/or analysed during the current study available from the corresponding author on reasonable request.

## References

1. Rupp, M., Tkatchenko, A., Müller, K.-R. & Von Lilienfeld, O. A. Fast and accurate modeling of molecular atomization energies with machine learning. Phys. Rev. Lett. 108, 058301 (2012).

2. Hamilton, W.L., Ying, R. & Leskovec, J. Representation learning on graphs: Methods and applications. IEEE Data Eng. Bull. (2017).

3. Wu, Z. et al. A comprehensive survey on graph neural networks. IEEE Transactions on Neural Networks and Learning Systems (2020).

4. Duvenaud, D. K. et al. Convolutional networks on graphs for learning molecular fingerprints. In Adv. Neural Inf. Process. Syst. 28, 2224–2232 (2015).

5. Gilmer, J., Schoenholz, S.S., Riley, P.F., Vinyals, O. & Dahl, G.E. Neural message passing for quantum chemistry. In ICML, 1263–1272 (2017).

6. Kearnes, S., McCloskey, K., Berndl, M., Pande, V. & Riley, P. Molecular graph convolutions: Moving beyond fingerprints. J. Comput. Aided Mol. Design 30, 595–608 (2016).

7. Veličković, P. et al. Graph attention networks. In ICLR (2018).

8. Hamilton, W., Ying, Z. & Leskovec, J. Inductive representation learning on large graphs. Adv. Neural Inf. Process. Syst., 1024–1034 (2017).

9. Li, R., Wang, S., Zhu, F. & Huang, J. Adaptive graph convolutional neural networks. arXiv:1801.03226 (2018).

10. Xu, K., Hu, W., Leskovec, J. & Jegelka, S. How powerful are graph neural networks? In ICLR (2018).

11. Liu, Q., Allamanis, M., Brockschmidt, M. & Gaunt, A. Constrained graph variational autoencoders for molecule design. In Adv. Neural Inf. Process. Syst. 31, 7795–7804 (2018).

12. You, J., Liu, B., Ying, Z., Pande, V. & Leskovec, J. Graph convolutional policy network for goal-directed molecular graph generation. In Adv. Neural Inf. Process. Syst. 31, 6410–6421 (2018).

13. De Cao, N., & Kipf, T. An implicit generative model for small molecular graphs. In DGMs, Molgan, (2018).

14. Ying, Z., Bourgeois, D., You, J., Zitnik, M. & Leskovec, J. GNNExplainer: Generating explanations for graph neural networks. Adv. Neural Inf. Process. Syst. 32, 9244–9255 (2019).

15. Akita, H. et al. Bayesgrad: Explaining predictions of graph convolutional networks. In ICONIP, 81–92 (2018).

16. Harada, S. et al. Dual graph convolutional neural network for predicting chemical networks. BMC Bioinform. 21, 1–13 (2020).

17. Wang, H., Lian, D., Zhang, Y., Qin, L. & Lin, X. Gognn: Graph of graphs neural network for predicting structured entity interactions. In IJCAI (2020).

18. Llinas, A., Burley, J. C., Box, K. J., Glen, R. C. & Goodman, J. M. Diclofenac solubility: Independent determination of the intrinsic solubility of three crystal forms. J. Med. Chem. 50, 979–983 (2007).

19. Raymer, B. & Bhattacharya, S. K. Lead-like drugs: A perspective: Miniperspective. J. Med. Chem. 61, 10375–10384 (2018).

20. Hann, M. M. Molecular obesity, potency and other addictions in drug discovery. Med. Chem. Commun. 2, 349–355 (2011).

21. Jia, X. et al. Anthropogenic biases in chemical reaction data hinder exploratory inorganic synthesis. Nature 573, 251–255 (2019).

22. Lipinski, C. A. Lead-and drug-like compounds: The rule-of-five revolution. Drug Discov. Today Technol. 1, 337–341 (2004).

23. Hattori, K., Wakabayashi, H. & Tamaki, K. Predicting key example compounds in competitors’ patent applications using structural information alone. J. Chem. Inf. Model. 48, 135–142 (2008).

24. Walker, R. et al. Applications of Reference Materials in Analytical Chemistry (2001).

25. Kearnes, S., Goldman, B. & Pande, V. Modeling industrial ADMET data with multitask networks. arXiv:1606.08793 (2016).

26. Wallach, I. & Heifets, A. Most ligand-based classification benchmarks reward memorization rather than generalization. J. Chem. Inf. Model. 58, 916–932 (2018).

27. Chen, G. et al. Alchemy: A quantum chemistry dataset for benchmarking ai models. arXiv:1906.09427 (2019).

28. Kovács, D. P., McCorkindale, W. & Lee, A. A. Quantitative interpretation explains machine learning models for chemical reaction prediction and uncovers bias. Nat. Commun. 12, 1–9 (2021).

29. Quionero-Candela, J., Sugiyama, M., Schwaighofer, A. & Lawrence, N.D. Dataset Shift in Machine Learning (The MIT Press, 2009).

30. Pan, S. J. & Yang, Q. A survey on transfer learning. IEEE Trans. Knowl. Data Eng. 22, 1345–1359 (2009).

31. Ganin, Y. et al. Domain-adversarial training of neural networks. J. Mach. Learn. Res. 17, 2096–2030 (2016).

32. Tzeng, E., Hoffman, J., Saenko, K. & Darrell, T. Adversarial discriminative domain adaptation. In CVPR, 7167–7176 (2017).

33. Tang, H. & Jia, K. Discriminative adversarial domain adaptation. In AAAI, 5940–5947 (2020).

34. Tanwani, A.K. Domain-invariant representation learning for sim-to-real transfer. arXiv preprintarXiv:2011.07589 (2020).

35. Long, M., Cao, Z., Wang, J. & Jordan, M.I. Conditional adversarial domain adaptation. arXiv preprintarXiv:1705.10667 (2017).

36. Lee, S., Kim, D., Kim, N. & Jeong, S.-G. Drop to adapt: Learning discriminative features for unsupervised domain adaptation. In ICCV, 91–100 (2019).

37. Ma, X., Zhang, T. & Xu, C. Gcan: Graph convolutional adversarial network for unsupervised domain adaptation. In CVPR, 8266–8276 (2019).

38. Imbens, G.W. & Rubin, D.B. Causal inference in statistics, social, and biomedical sciences (2015).

39. Schnabel, T., Swaminathan, A., Singh, A. & Chandak, N., & Joachims, T. Recommendations as treatments: Debiasing learning and evaluation. In ICML (2016).

40. Ma, W. & Chen, G.H. Missing not at random in matrix completion: The effectiveness of estimating missingness probabilities under a low nuclear norm assumption. arXiv preprintarXiv:1910.12774 (2019).

41. Zhang, G. et al. Selection bias explorations and debias methods for natural language sentence matching datasets. arXiv preprintarXiv:1905.06221 (2019).

42. Eichler, H.-G. et al. Threshold-crossing: A useful way to establish the counterfactual in clinical trials?. Clin. Pharmacol. Therapeutics 100, 699–712 (2016).

43. LaLonde, R.J. Evaluating the econometric evaluations of training programs with experimental data. The American economic review 604–620 (1986).

44. Zhao, S. & Heffernan, N. Estimating individual treatment effect from educational studies with residual counterfactual networks. International Educational Data Mining Society (2017).

45. Shalit, U., Johansson, F.D. & Sontag, D. Estimating individual treatment effect: generalization bounds and algorithms. In ICML, 3076–3085 (2017).

46. Yao, L. et al. Representation learning for treatment effect estimation from observational data. In Adv. Neural Inf. Process. Syst. 31, 2633–2643 (2018).

47. Hassanpour, N. & Greiner, R. Counterfactual regression with importance sampling weights. In IJCAI, 5880–5887 (2019).

48. Ramakrishnan, R., Dral, P. O., Rupp, M. & Von Lilienfeld, O. A. Quantum chemistry structures and properties of 134 kilo molecules. Sci. Data 1, 140022 (2014).

49. Gómez-Bombarelli, R. et al. Automatic chemical design using a data-driven continuous representation of molecules. ACS Central Sci. 4, 268–276 (2018).

50. Wu, Z. et al. Moleculenet: A benchmark for molecular machine learning. Chem. Sci. 9, 513–530 (2018).

51. Ruddigkeit, L., Van Deursen, R., Blum, L. C. & Reymond, J.-L. Enumeration of 166 billion organic small molecules in the chemical universe database gdb-17. J. Chem. Inf. Model. 52, 2864–2875 (2012).

52. Chen, X., Wang, S., Long, M. & Wang, J. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In ICML, 1081–1090 (2019).

53. Sousa-Silva, C., Petkowski, J. J. & Seager, S. Physical chemistry chemical physics. Phys. Chem. Chem. Phys. 21, 18970–18987 (2019).

54. Aihara, J. Reduced HOMO-LUMO gap as an index of kinetic stability for polycyclic aromatic hydrocarbons. J. Phys. Chem. A 103, 7487–7495 (1999).

55. Fey, M. & Lenssen, J.E. Fast graph representation learning with PyTorch Geometric. In ICLR Workshop on Representation Learning on Graphs and Manifolds (2019).

56. Kingma, D.P. & Ba, J. Adam: a method for stochastic optimization. arXiv:1412.6980 (2014).

57. Cuturi, M. & Doucet, A. Fast computation of wasserstein barycenters. In ICML, 685–693 (2014).

## Acknowledgements

We are grateful to Yoshihiro Yamanishi, Ichhigaku Takigawa, and Shonosuke Harada for valuable information and discussions. This work is partially supported by JSPS KAKENHI GrantNumber 20H00609.

## Author information

Authors

### Contributions

Y.L. and H.K. contributed to the study design. Y.L. conducted the experiments and analyzed the results. H.K. gave technical support and conceptual advice for the methodology. The first draft of the manuscript was written by Y.L., and the revised manuscript was written by H.K. All authors reviewed and approved the final manuscript.

### Corresponding author

Correspondence to Yang Liu.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

### Publisher's note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Liu, Y., Kashima, H. Chemical property prediction under experimental biases. Sci Rep 12, 8206 (2022). https://doi.org/10.1038/s41598-022-12116-5

• Accepted:

• Published:

• DOI: https://doi.org/10.1038/s41598-022-12116-5